Class FileSystemObject (Scripting VBA)
Provides access to a computer's file system.
Methods
OpenTextFile - Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending, TristateFalse)
f.Write "Hello world!"
f.Close
End Sub
BuildPath - Combines a folder path and the name of a folder or file and returns the combination with valid path separators.
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 that can be used to read from or write to the file.
DeleteFile - Deletes a specified file.
DeleteFolder - Deletes a specified folder and its contents.
DriveExists - Returns True if the specified drive exists; False if it does not.
FileExists - Returns True if a specified file exists; False if it does not.
FolderExists - Returns True if a specified folder exists; False if it does not.
GetAbsolutePathName - Returns a complete and unambiguous path from a provided path specification.
GetBaseName - Returns a string containing the base name of the last component, less any file extension, in a path.
GetDrive - Returns a Drive object corresponding to the drive in a specified path.
GetDriveName - Returns a string containing the name of the drive for a specified path.
GetExtensionName - Returns a string containing the extension name for the last component in a path.
GetFile - Returns a File object corresponding to the file in a specified path.
GetFileName - Returns the last component of a specified 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 specified path.
GetSpecialFolder - Returns the special folder specified.
GetTempName - Returns a randomly generated temporary file or folder name that is useful for performing operations that require a temporary file or folder.
MoveFile - Moves one or more files from one location to another.
MoveFolder - Moves one or more folders from one location to another.
Properties
Drives returns a Drives collection consisting of all Drive objects available on the local machine.
Related Classes
Drive - Provides access to the properties of a particular disk drive or network share.
Drives - Read-only collection of all available drives.
File - Provides access to all the properties of a file.
Folder - Provides access to all the properties of a folder.
TextStream - Facilitates sequential access to file.