Previous Page
Next Page

Creating the File System Object

To talk to the file system, the script needs to make a connection to it so that it can read files and folders. The tool used with Microsoft Visual Basic, Scripting Edition (VBScript) is called the file system object. Once an instance of the file system object is created, you can leverage its power to perform some or all of the following tasks:

  • Create files and folders

  • Copy files and folders

  • Move files and folders

  • Delete files and folders

  • List properties of files and folders

Just the Steps

To enumerate a list of files

1.
Use CreateObject to create the file system object.

2.
Define the folder to be searched by using GetFolder.

3.
Use the Files command to list files.

4.
Use a For Each statement to walk through the folder.



Previous Page
Next Page