ASP FileSystemObject
Object
The FileSystemObject object is used to access the file system on the server.
Try It Yourself - Examples
Does the specified file exist?
Does the specified folder exist?
Does the specified drive exist?
Get the name of a specified drive
Get the name of the parent folder of a specified path
Get the base name of a file or folder
FileSystemObject Object
The FileSystemObject object is used to access the file system on the server.
This object can manipulate files, folders, and directory paths. It can also retrieve information about the file system.
The following code creates a text file (c:\test.txt) and writes some text to it:
Properties
Property | Description |
---|---|
Drives | Returns a collection of all drive objects on the local machine. |
Methods
Method | Description |
---|---|
BuildPath | Appends a name to an existing path. |
CopyFile | Copies one or more files from one location to another. |
CopyFolder | Copies one or more folders from one location to another. |
CreateFolder | Creates a new folder. |
CreateTextFile | Creates a text file and returns a TextStream object that can be used to read from or write to the file. |
DeleteFile | Deletes one or more specified files. |
DeleteFolder | Deletes one or more specified folders. |
DriveExists | Checks if the specified drive exists. |
FileExists | Checks if the specified file exists. |
FolderExists | Checks if the specified folder exists. |
GetAbsolutePathName | Returns the complete path from the root of the drive for the specified path. |
GetBaseName | Returns the base name of the specified file or folder. |
GetDrive | Returns the Drive object corresponding to the drive in the specified path. |
GetDriveName | Returns the drive name of the specified path. |
GetExtensionName | Returns the file extension of the last component in the specified path. |
GetFile | Returns a File object for the specified path. |
GetFileName | Returns the file name or folder name of the last component in the specified path. |
GetFolder | Returns a Folder object for the specified path. |
GetParentFolderName | Returns the name of the parent folder of the last component in the specified path. |
GetSpecialFolder | Returns the path of some special Windows folders. |
GetTempName | Returns a randomly generated 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. |
OpenTextFile | Opens a file and returns a TextStream object that can be used to access the file. |