The FileSystemObject Object |
The FileSystemObject object provides us with access to the underlying file system on the server (or on the client in IE5 when used in conjunction with a special type of page named a Hypertext Application or HTA). The FileSystemObject object exposes a series of properties and methods of its own, some of which return other objects that are specific to objects within the file system. These subsidiary objects are: The Drive object provides access to all the drives available on the machine The Folder object provides access to the folders on a drive The File object provides access to the files within each folder While these three objects form a neat hierarchy, the FileSystemObject object also provides methods that can bridge the hierarchy by creating instances of the subsidiary objects directly.

Drives |
| Property
Returns a collection of Drive objects that are available from the local machine. This includes network drives that are mapped from this machine.

BuildPath(path,name) |
| Method
Adds the file or folder specified in name to the existing path, adding a path separator character ('\') if required.

CopyFile(source,destination,overwrite) |
| Method
Copies the file or files specified in source (wildcards can be included) to the folder specified in destination. If source contains wildcards or destination ends with a path separator character ('\') then destination is assumed to be a folder, otherwise it is assumed to be a full path and name for the new file. An error will occur if the destination file already exists and the optional overwrite parameter is set to False. The default for overwrite is True.

CopyFolder(source,destination,overwrite) |
| Method
Copies the folder or folders specified in source (wildcards can be included) to the folder specified in destination, including all the files contained in the source folder(s). If source contains wildcards or destination ends with a path separator character ('\') then destination is assumed to be a folder into which the copied folder(s) will be placed, otherwise it is assumed to be a full path and name for a new folder to be created. An error will occur if the destination folder already exists and the optional overwrite parameter is set to False. The default for overwrite is True.

CreateFolder(foldername) |
| Method
Creates a new folder that has the path and name specified in foldername. An error occurs if the specified folder already exists.

CreateTextFile(filename, overwrite,unicode) |
| Method
Creates a new text file on disk with the specified filename and returns a TextStream object that refers to it. If the optional overwrite parameter is set to True any existing file with the same path and name will be overwritten. The default for overwrite is False. If the optional unicode parameter is set to True, the content of the file will be stored as Unicoded text. The default for unicode is False.

DeleteFile(filespec,force) |
| Method
Deletes the file or files specified in filespec (wildcards can be included). If the optional force parameter is set to True the file(s) will be deleted even if its read-only attribute is set. The default for force is False.

DeleteFolder(folderspec,force) |
| Method
Deletes the folder or folders specified in folderspec (wildcards can be included in the final component of the path) together with all their contents. If the optional force parameter is set to True, the folders will be deleted even if their, or any contained files', read-only attribute is set. The default for force is False.

DriveExists(drivespec) |
| Method
Returns True if the drive specified in drivespec exists, or False if not. The drivespec parameter can be a drive letter as a string or a full absolute path for a folder or file.

FileExists(filespec) |
| Method
Returns True if the file specified in filespec exists, or False if not. The filespec parameter can contain an absolute or relative path for the file, or just the file name to look in the current folder.

FolderExists(folderspec) |
| Method
Returns True if the folder specified in folderspec exists, or False if not. The folderspec parameter can contain an absolute or relative path for the folder, or just the folder name to look in the current folder.

GetAbsolutePathName(pathspec) |
| Method
Takes a path that unambiguously identifies a folder and, taking into account the current folder's path, returns a full path specification for the pathspec folder. For example, if the current folder is "c:\docs\sales\" and pathspec is "jan" the returned value is "c:\docs\sales\jan". Wildcards and the ".." and "\\" path operators are accepted.

GetBaseName(filespec) |
| Method
Returns just the name of a file specified in filespec, i.e. with the path and file extension removed.

GetDrive(drivespec) |
| Method
Returns a Drive object corresponding to the drive specified in drivespec. The format for drivespec can include the colon, path separator or be a network share, i.e. "c", "c:", "c:\" or "\\machine\sharename".

GetDriveName(drivespec) |
| Method
Returns the name of the drive specified in drivespec as a string. The drivespec parameter must be an absolute path to a file or folder, or just the drive letter such as "c:" or just "c".

GetExtensionName(filespec) |
| Method
Returns just the file extension of a file specified in filespec, i.e. with the path and file name removed.

GetFile(filespec) |
| Method
Returns a File object corresponding to the file specified in filespec. This can be a relative or absolute path to the required file.

GetFileName(pathspec) |
| Method
Returns the name part of the path and filename specified in pathspec, or the last folder name of there is no file name. Does not check for existence of the file or folder.

GetFolder(folderspec) |
| Method
Returns a Folder object corresponding to the folder specified in folderspec. This can be a relative or absolute path to the required folder.

GetParentFolderName(pathspec) |
| Method
Returns the name of the parent folder of the file or folder specified in pathspec. Does not check for the existence of the folder.

GetSpecialFolder(folderspec) |
| Method
Returns a Folder object corresponding to one of the special Windows folders. The permissible values for folderspec are WindowsFolder (0), SystemFolder (1) and TemporaryFolder (2).

GetTempName() |
| Method
Returns a randomly generated file name that can be used for performing operations that require a temporary file or folder.

MoveFile(source,destination) |
| Method
Moves the file or files specified in source to the folder specified in destination. Wildcards can be included in source but not in destination. If source contains wildcards or destination ends with a path separator character ('\') then destination is assumed to be a folder, otherwise it is assumed to be a full path and name for the new file. An error will occur if the destination file already exists.

MoveFolder(source,destination) |
| Method
Moves the folder or folders specified in source to the folder specified in destination. Wildcards can be included in source but not in destination. If source contains wildcards or destination ends with a path separator character ('\') then destination is assumed to be the folder in which to place the moved folders, otherwise it is assumed to be a full path and name for a new folder. An error will occur if the destination folder already exists.

OpenTextFile(filename,iomode,create,format) |
| Method
Creates a file named filename, or opens an existing file named filename, and returns a TextStream object that refers to it. The filename parameter can contain an absolute or relative path. The iomode parameter specifies the type of access required. The permissible values are ForReading (1 - the default), ForWriting (2), and ForAppending (8). If the create parameter is set to True when writing or appending to a file that does not exist, a new file will be created. The default for create is False. The format parameter specifies the format of the data to be read from or written to the file. Permissible values are TristateFalse (0, the default) to open it as ASCII, TristateTrue (-1) to open it as Unicode, and TristateUseDefault (-2) to open it using the system default format.