Version: 3.0
The File object allows you access and manipulate the various properties of a file.
<%
Dim filesys,demofile, createdate
Set filesys = CreateObject("Scripting.FileSystemObject")
Setdemofile = filesys.GetFile("filename")
createdate = demofile.DateCreated
%>
This code uses the GetFile method of the FileSystemObject object to create a File object and view one of its properties.
Syntax: object.Attributes [ =newattributes]
This property allows us to get or change the various attributes of a file.
Syntax: object.DateCreated
This property gets the date and time that the file was created.
Syntax: object.DateLastAccessed
Gets the date and time that the file was last accessed
Syntax: object.DateLastModified
This property returns the date and time that the file was last modified.
Syntax: object.Drive
Returns the drive letter of the drive where the file is located.
Syntax: object.Name
Lets us get or change the name of the specified file.
Syntax: object.ParentFolder
This property gets the Folder object for the parent relating to the specified file.
Syntax: object.Path
This property returns a file's path.
Syntax: object.ShortName
Returns the short version of a filename (using the 8.3 convention). e.g. Employees.html is truncated to Employ~1.htm
Syntax: object.ShortPath
Returns the short version of the file path (this is the path with any folder and file names truncated as above).
Syntax: object.Size
Returns the size of a file in bytes.
Syntax: object.Type
Returns a string containing the file type description. e.g. For files ending in .TXT, "Text Document" is returned.
Syntax: object.Copy destination[, overwrite]
This method copies the selected file to the specified destination.
Syntax: object.Delete [force]
The method used to delete the file relating to the specified File object.
Syntax: object.Move destination
This method is used to move the file relating to the specified File object to a new destination.
Syntax: object.OpenAsTextStream([iomode [,format]])
This method opens a specified file and returns an instance of a TextStream object that can then be manipulated - read from, written or appended to.