• Welcome to Jose's Read Only Forum 2023.
 

IFile.DateLastAccessed Property

Started by José Roca, July 14, 2008, 03:58:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following code illustrates the use of the DateLastAccessed property with a file:

JScript


function ShowFileAccessInfo(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = f.Path.toUpperCase() + "<br>";
   s += "Created: " + f.DateCreated + "<br>";
   s += "Last Accessed: " + f.DateLastAccessed + "<br>";
   s += "Last Modified: " + f.DateLastModified   
   return(s);
}



VBScript


Function ShowFileAccessInfo(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = f.Path & "<br>"
   s = s & "Created: " & f.DateCreated & "<br>"
   s = s & "Last Accessed: " & f.DateLastAccessed & "<br>"
   s = s & "Last Modified: " & f.DateLastModified   
   ShowFileAccessInfo = s
End Function



PowerBASIC


FUNCTION ShowFileAccessInfo (BYVAL strFileSpec AS STRING) AS STRING

   LOCAL fso AS IFileSystem
   LOCAL f AS IFile
   LOCAL s AS STRING

   fso = NEWCOM ("Scripting.FileSystemObject")
   f = fso.GetFile(UCODE$(strFileSpec))
   s = ACODE$(f.Path)
   s = s & "Created: " & PB_VariantDateToString(f.DateCreated) & $CRLF
   s = s & "Last Accessed: " & PB_VariantDateToString(f.DateLastAccessed) & $CRLF
   s = s & "Last Modified: " & PB_VariantDateToString(f.DateLastModified)
   FUNCTION = s

END FUNCTION