WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ASP File Object


The File object is utilized to return data about a predefined file.


The File Object

The File object is utilized to return data about a predetermined file.

To work with the properties and strategies for the File object, you should make a case of the File object through the FileSystemObject object. First; make a FileSystemObject item and afterward instantiate the File object through the GetFile strategy for the FileSystemObject object or through the Files property of the Folder object.

The following code utilizes the GetFile strategy for the FileSystemObject item to instantiate the File object and the DateCreated property to restore the date when the predefined record was created:

Example

<%
Diminish fs,f
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\test.txt")
Response.Write("File made: " & f.DateCreated)
set f=nothing
set fs=nothing
%>

The File item's properties and techniques are portrayed below:

Properties

Property Description
Attributes Sets or returns the traits of a predetermined file
DateCreated Returns the date and time when a predetermined record was created
DateLastAccessed Returns the date and time when a predetermined record was last accessed
DateLastModified Returns the date and time when a predetermined record was last modified
Drive Returns the drive letter of the drive where a predetermined record or envelope resides
Name Sets or returns the name of a predetermined file
ParentFolder Returns the envelope object for the parent of the predetermined file
Path Returns the way for a predetermined file
ShortName Returns the short name of a predetermined record (the 8.3 naming convention)
ShortPath Returns the short way of a predetermined record (the 8.3 naming convention)
Size Returns the size, in bytes, of a predetermined file
Type Returns the sort of a predefined file

Methods

Method Description
Copy Copies a predefined document from one area to another
Delete Deletes a predefined file
Move Moves a predefined document from one area to another
OpenAsTextStream  Opens a predefined document and returns a TextStream item to get to the file