Easy Tutorial
❮ Asp Ajax Intro Met Getparentfoldername ❯

ASP File Object


The File object is used to return information about a specified file.


Try It Yourself - Examples

What is the last modified time of a file?

What is the last accessed time of a file?

Return the attributes of a specified file


File Object

The File object is used to return information about a specified file.

To work with the properties and methods of the File object, you need to create an instance of the File object through the FileSystemObject object. First, create a FileSystemObject object, then instantiate the File object using the GetFile method of the FileSystemObject object, or through the Files property of the Folder object.

The following code uses the GetFile method of the FileSystemObject object to instantiate the File object and uses the DateCreated property to return the creation date of the specified file:

Example

The properties and methods of the File object are described as follows:

Properties

Property Description
Attributes Sets or returns the attributes of the specified file.
DateCreated Returns the date and time the specified file was created.
DateLastAccessed Returns the date and time the specified file was last accessed.
DateLastModified Returns the date and time the specified file was last modified.
Drive Returns the drive letter of the drive where the specified file or folder is located.
Name Sets or returns the name of the specified file.
ParentFolder Returns the parent folder object of the specified file.
Path Returns the path of the specified file.
ShortName Returns the short name of the specified file (8.3 naming convention).
ShortPath Returns the short path of the specified file (8.3 naming convention).
Size Returns the size of the specified file in bytes.
Type Returns the type of the specified file.

Methods

Method Description
Copy Copies the specified file from one location to another.
Delete Deletes the specified file.
Move Moves the specified file from one location to another.
OpenAsTextStream Opens the specified file and returns a TextStream object to access this file.
❮ Asp Ajax Intro Met Getparentfoldername ❯