The File object represents a specified file on the local machine or on a network share. To work with the File object's properties and methods, you need to create an instance of the FileSystemObject object first and then instantiate the File object through the GetFile method. Also you can get a File object reference from the Folder object, by using the Files Collection.
The File object properties and methods are as follows:
The Attributes property sets or returns (depending on the specific file attribute) the attributes of the specified file.
The DateCreated property returns the date and time that the specified file was created.
The DateCreated property returns the date and time that the specified file was last accessed.
The DateCreated property returns the date and time that the specified file was last modified. It refers to the most recent date the file was altered, not simply opened or examined.
The Drive property returns the drive letter of the drive on which the specified file or folder resides.
The Name property sets or returns the name of the specified file.
The ParentFolder returns the Folder object for the parent folder of the specified file.
The Path property returns the absolute path of the specified file.
The ShortName property returns the DOS-style version of the file name (the 8.3 naming convention).
The ShortPath property returns the DOS-style version of the absolute path of the specified file (the 8.3 naming convention).
The Size property returns the size of the specified file (in bytes).
The Type property returns the type of the specified file, as determined using your machine's file associations (if one exists). For example, on a machine with Microsoft Access installed, the file examples.mdb would have a Type property of Microsoft Office Access Application.
The Copy method copies the specified file from one folder to another.
The Delete method deletes the specified file.
The Move method moves the specified file from one folder to another.
The OpenAsTextStream method opens the specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
How to use the ASP File Object
In the following example we create an instance of the FileSystemObject object and then use the GetFile method to instantiate the File object. After that we use The File object properties to get the information about the specified file:
<% Dim objFSO, objDrive 'Create a FileSystemObject instance Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Using the GetFile method of FileSystemObject object, initialize a File object Set objFile = objFSO.GetFile("c:\test.txt") 'Retrieve information about the file Response.Write "Name: " & objFile.Name & "<br />" Response.Write "ShortName: " & objFile.ShortName & "<br />" Response.Write "Size: " & objFile.Size & " bytes <br />" Response.Write "Type: " & objFile.Type & "<br />" Response.Write "Path: " & objFile.Path & "<br />" Response.Write "ShortPath: " & objFile.ShortPath & "<br />" Response.Write "Created: " & objFile.DateCreated & "<br />" Response.Write "LastModified: " & objFile.DateLastModified & "<br /><br />" %>