Building WebApps  «Prev  

Some FileSystemObject Methods in ASP

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 (and contents) from one location to another.
CreateFolder Creates a folder
CreateTextFile Creates a text file with a specified name and returns a TextStream object.
DeleteFile Deletes a specified file.
DeleteFolder Deletes a specified folder (and contents)
DriveExists Does a specific drive exist (True/False)?
FileExists Does a specific file exist (True/False)?.
FolderExists Does a specific folder exist (True/False)?
GetAbsolutePathName Returns a literal (absolute) path name.
GetBaseName Returns a string containing the base name of the last component, less any extension, in a path.
GetDrive Returns a Drive object corresponding to the drive in a specified path.
GetDriveName Returns the name of a drive for a specified path.
GetExtensionName Returns the extension name at the end of a path.
GetFile Returns a File object corresponding to the file in a path.
GetFileName Returns the filename at the end of a specified path.
GetFolder Returns a Folder object corresponding to the folder in a specified path.
GetParentFolderName Returns a string containing the name of the parent folder in a specified path.
MoveFile Moves one or more files from one location to another.
MoveFolder Moves one or more folders (and contents) from one location to another.
OpenTextFile Opens a specified file and returns a TextStream object.

ASP File Manipulation

In addition to the native ASP objects (Request, Response, etc.) and the various installable components (1) Ad Rotator, 2) Browser Capabilities), you also have access to a third group of objects. These objects are instantiated directly from the Microsoft Scripting Runtime DLL (scrrun.dll ). This DLL contains functionality that is neither in the native ASP objects nor in the VBScript runtime (vbscript.dll) itself. From the scripting DLL, you can instantiate objects that provide your application with extensive file manipulation capabilities. (From this DLL, you also can create a Dictionary object that provides you with a way to perform collection-type functions without true collections.)
All file manipulation is performed by the FileSystemObject object. Your application will have only one of these, and it represents your application's "window" onto the system's file structures. With this object, you are able to perform some simple functions such as opening and closing files, but the real strength of this object is that through it you are able to instantiate the other file manipulation objects: Drive, Folder, and File.
Through these objects, your application has almost all the power over the file system that you have through a command-line interface.