OBJECT:  File

object.GetFile ("filename")

Before we can access and manipulate the various properties of a file we have to create an instance of the File object.

The following code uses the GetFile method of the FileSystemObject object to obtain a File object and view one of it's properties.

Code:
<%
Dim filesys, demofile, createdate
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofile = filesys.GetFile("filename")
createdate = demofile.DateCreated
%>

PROPERTIES

Attributes Property
This property allows us to get or change the various attributes of a file.

Syntax: object.Atributes [ = newattributes]

DateCreated Property
This property gets the date and time that the file was created.

Syntax: object.DateCreated

DateLastAccessed Property
Gets the date and time that the file was last accessed.

Syntax: object.DateLastAccessed

DateLastModified Property
This property returns the date and time that the file was last modified.

Syntax: object.DateLastModified

Drive Property
Returns the drive letter of the drive where the file is located.

Syntax: object.Drive

Name Property
Lets us get or change the name of the specified file.

Syntax: object.Name [ = newname]

ParentFolder Property
This property gets the Folder object for the parent relating to the specified file.

Syntax: object.ParentFolder

Path Property
This property returns a file's path.

Syntax: object.Path

ShortName Property
Returns the short version of a filename (using the 8.3 convention).
e.g. Employees.html is truncated to Employ~1.htm

Syntax: object.ShortName

ShortPath Property
Returns the short version of the file path (this is the path with any folder and file names truncated as above).

Syntax: object.ShortPath

Size Property
Returns the size of a file in bytes.

Syntax: object.Size

TypeProperty
Returns a string containing the file type description.
e.g. For files ending in .TXT, "Text Document" is returned.

Syntax: object.Type


METHODS

Copy Method
This method copies the selected file to the specified destination.

Syntax: object.Copy destination[, overwrite]

Delete Method
The method used to delete the file relating to the specified File object.

Syntax: object.Delete [force]

Move Method
This method is used to move the file relating to the specified File object to a new destination.

Syntax: object.Move destination

OpenAsTextStream Method
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.

Syntax: object.OpenAsTextStream([iomode [, format]])




Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information