Windows Scripting
  Home arrow Windows Scripting arrow Page 5 - An Introduction to Files and Folders in WS...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

An Introduction to Files and Folders in WSH
By: Nilpo/Developer Shed Staff Writer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2007-02-05

    Table of Contents:
  • An Introduction to Files and Folders in WSH
  • Enumerating Files and Folders
  • Working with Files and Folders
  • Using the Sub-Objects
  • Using What You’ve Learned

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    An Introduction to Files and Folders in WSH - Using What You’ve Learned


    (Page 5 of 5 )

    In part two of this series we’ll take a look at some of the more advanced methods and properties that the FileSystemObject has to offer.  In the meantime, play around with this a bit.

    You’ll begin to see that every task for which you write code can be accomplished in two or three other ways.  That goes to show the flexibility that VBScript and WSH have.

    I’m sure someone at this point is wondering how to rename files and folders, right?  I’ve shown you all of the basic file operations except that.  Well, here’s why.  Think about what a rename really is.

    At the file or folder level, the computer must make a copy of the original file with a new name and then delete the first.  There is no need to have another method for this when we can perform the same procedure with the ones we have.

    The simplest way to perform a file (or folder) rename is to use the corresponding move method.  Just supply the new filename for the destination.  Here’s a quick example of how to rename C:text1.txt into C:text2.txt

    Set objFso = CreateObject("Scripting.FileSystemObject")

    objFso.MoveFile "C:text1.txt", "C:text2.txt"

    Believe me when I tell you that we’ve barely scratched the surface.  Stick around for part two of this series and learn some of the cool tricks that the FileSystemObject can do.  You won’t want to miss it.  Until next time, keep coding!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · VBScript's FileSystemObject provides a very useful interface for accessing files and...
     

    WINDOWS SCRIPTING ARTICLES

    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH
    - Advanced Word Object Scripting
    - Reading and Printing Word Documents in WSH
    - Scripting Microsoft Word
    - Using WSH to Catalog MP3 Files
    - Reading MP3 ID3 Tags in WSH
    - A Brief Look at Menus in WPF
    - More Examples of Simplified Image Processing...
    - Completing a WPF To-Do List Application
    - Simplified Image Processing in GDI+





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT