VBScript's File-Handling Objects |
Properties and methods of FileSystemObjects |
Drives property |
Returns a collection of Drive objects for all the drives in the file system. |
BuildPath method |
Appends a filename to an existing path, inserting a separator if necessary. |
CopyFile method |
Copies one or more files from one folder to another. |
CopyFolder method |
Recursively copies a folder or subfolder to another. |
CreateFolder method |
Creates a folder with a given name. |
CreateTextFile method |
Creates a text file with the given file specification and returns a TextStream object that can be used to write to the file. |
DeleteFile method |
Deletes the specified file. |
DeleteFolder method |
Deletes the specified folder and all its contents--even if the folder has files in it. |
DriveExists method |
Returns True only if the specified drive exists. |
FileExists method |
Returns True only if the specified file exists. |
FolderExists method |
Returns True only if the specified folder exists. |
GetAbsolutePathName method |
Converts a relative path (such as "..\data") to a complete and unambiguous path specification. |
GetBaseName method |
Returns the base filename of a path (minus any extension). |
GetDrive method |
Returns a Drive object corresponding to a specified drive. |
GetDriveName method |
Returns the drive portion of a path. |
GetExtensionName method |
Returns the extension portion of a path. |
GetFile method |
Returns a File object associated to the file specification. |
GetFileName method |
Returns the filename portion (including extension) of a path. |
GetFolder method |
Returns a Folder object for a given path specification. |
GetParentFolderName method |
Returns a string that identifies the parent folder of a given folder. |
GetSpecialFolder method |
Passes 0 to get the location of the Windows folder, 1 for the System folder, and 2 for the Temp folder. |
GetTempName method |
Returns a randomly generated name for use as a temporary file or folder. (Although the documentation doesn't say so, experimentation seems to indicate that the name will be unique.) |
MoveFile method |
Moves the file from one location to another. |
MoveFolder method |
Moves the folder (including its contents) from one location to another. |
OpenTextFile method |
Opens a file by returning a TextStream object you can use to write or append to the given object. |
Properties and methods common to both Folder and File objects |
Attributes property |
Sets or returns the attributes of the file or folder. (Uses bit masking to get at the individual attributes.) |
DateCreated property |
Read-only property that returns the date and time the file or folder was created. |
DateLastAccessed property |
Read-only property that returns the date and time the file or folder was last accessed. |
DateLastModified property |
Read-only property that returns the date and time the file or folder was last modified. |
Drive property |
Returns a Drive object for the drive on which the file or folder lives. |
Name property |
Returns a string that gives the name of the file or folder. |
ParentFolder property |
Returns a Folder object for the parent folder of the file or folder. |
Path property |
Returns the path for the file or folder. |
ShortName property |
Returns the name of the file or folder in 8+3 (DOS) format |
ShortPath property |
Returns the pathname of the file or folder in 8+3 (DOS) format. |
Size property |
Returns the size of the file in bytes, or the size of all files and subfolders in a folder. |
Copy method |
Copies the folder (and all its contents) or the file from one location to another. |
Delete method |
Deletes the file or folder even if it is not empty. |
Move method |
Moves the folder (and all its contents) or the file from one location to another. |
Properties and methods unique to Folder objects |
IsRootFolder property |
Returns True if the folder is the root of the drive and False otherwise. |
SubFolders property |
Returns a collection of the subfolders inside the given folder. |
CreateTextFile method |
Creates a text file (or Unicode file) in the folder and returns a TextStream object to allow you to work with it. |
Properties and methods unique to File objects |
Type property |
Returns the file type registered with the system based on a file's extension. |
OpenAsTextStream method |
Returns a TextStream object you can use to read from, write to, or append to the file. |