Previous PageNext Page

8.10 FileSystemObject Object

The FileSystemObject object provides access to a computer's file system.
 

Methods

BuildPath
 
Appends a name to an existing path.
 
CopyFile
 
Copies one or more files from one location to another.
 
CopyFolder
 
Recursively copies a folder from one location to another.
 
CreateFolder
 
Creates a folder.
 
CreateTextFile
 
Creates a specified file name and returns a TextStream object.
 
DeleteFile
 
Deletes one or more files.
 
DeleteFolder
 
Deletes a folder and its contents.
 
DriveExists
 
Indicates the existence of a drive.
 
FileExists
 
Indicates the existence of a file.
 
FolderExists
 
Indicates the existence of a folder.
 
GetAbsolutePathName
 
Returns a complete and unambiguous path from a provided path specification.
 
GetBaseName
 
Returns the base name of a path.
 
GetDrive
 
Returns a Drive object corresponding to the drive in a path. This method is not currently supported on UNIX.
 
GetDriveName
 
Returns a string containing the name of the drive for a path.
 
GetExtensionName
 
Returns a string containing the extension for the last component in a path.
 
GetFile
 
Returns a File object corresponding to the file in a path.
 
GetFileName
 
Returns the last component of a path that is not part of the drive specification.
 
GetFolder
 
Returns a Folder object corresponding to the folder in a specified path.
 
GetParentFolderName
 
Returns a string containing the name of the parent folder of the last component in a path.
 
GetSpecialFolder
 
Returns the special folder requested.
 
GetTempName
 
Returns a randomly generated temporary file or folder name.
 
MoveFile
 
Moves one or more files from on location to another.
 
MoveFolder
 
Moves one or more folders from one location to another.
 
OpenTextFile
 
Opens a file and returns a TextStream object.
 

Properties

Drives
 
A Drives collection of all Drive objects available on the local machine.
 

Syntax

Scripting.FileSystemObject

Remarks

The following code illustrates how the 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 WriteLine method writes a line of text to the created text file. The Close method flushes the buffer and closes the file.
 

Copyright © 2000 Chili!Soft

Previous PageTop Of PageNext Page