|
The VBScript FileSystemObject object provides access to a computer's file system.
Appends a name to an existing path. | |
Copies one or more files from one location to another. | |
Recursively copies a folder from one location to another. | |
Creates a folder. | |
Creates a specified file name and returns a TextStream object. | |
Deletes one or more files. | |
Deletes a folder and its contents. | |
Indicates the existence of a drive. | |
Indicates the existence of a file. | |
Indicates the existence of a folder. | |
Returns a complete and unambiguous path from a provided path specification. | |
Returns the base name of a path. | |
Returns a Drive object corresponding to the drive in a path. This method is not currently supported on UNIX. | |
Returns a string containing the name of the drive for a path. | |
Returns a string containing the extension for the last component in a path. | |
Returns a File object corresponding to the file in a path. | |
Returns the last component of a path that is not part of the drive specification. | |
Returns a Folder object corresponding to the folder in a specified path. | |
Returns a string containing the name of the parent folder of the last component in a path. | |
Returns the special folder requested. | |
Returns a randomly generated temporary file or folder name. | |
Moves one or more files from one location to another. | |
Moves one or more folders from one location to another. | |
Opens a file and returns a TextStream object. |
Note
Collections returned by FileSystemObject method calls reflect the state of the file system when the collection was created. Changes to the file system after creation are not reflected in the collection. If the file system might be changed during the lifetime of the collection object, the method returning the collection should be called again to ensure that the contents are current.
A Drives collection of all Drive objects available on the local machine. |
Scripting.FileSystemObject
The following code illustrates how FileSystemObject is used to return a TextStream object that can be read from or written to:
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("This is a test.")
a.Close
In the code shown above, the CreateObject function returns the FileSystemObject (fs). The CreateTextFile method then creates the file as a TextStream object (a) and the VBScript TextStream Object WriteLine Method writes a line of text to the created text file. The VBScript TextStream Object Close Method flushes the buffer and closes the file.
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.