Thursday, 23 July 2009

ASP File System Object

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

Example

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

PropertyDescription
AttributesSets or returns the attributes of a specified file
DateCreatedReturns the date and time when a specified file was created
DateLastAccessedReturns the date and time when a specified file was last accessed
DateLastModifiedReturns the date and time when a specified file was last modified
DriveReturns the drive letter of the drive where a specified file or folder resides
NameSets or returns the name of a specified file
ParentFolderReturns the folder object for the parent of the specified file
PathReturns the path for a specified file
ShortNameReturns the short name of a specified file (the 8.3 naming convention)
ShortPathReturns the short path of a specified file (the 8.3 naming convention)
SizeReturns the size, in bytes, of a specified file
TypeReturns the type of a specified file

Methods

MethodDescription
CopyCopies a specified file from one location to another
DeleteDeletes a specified file
MoveMoves a specified file from one location to another
OpenAsTextStream Opens a specified file and returns a TextStream object to access the file





No comments:

Post a Comment