Author Topic: IFile.DateLastAccessed Property  (Read 3106 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2517
  • User-Rate: +209/-0
  • Gender: Male
IFile.DateLastAccessed Property
« on: July 14, 2008, 03:58:49 AM »

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

JScript

Code: [Select]
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

Code: [Select]
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

Code: [Select]
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
« Last Edit: July 14, 2008, 04:00:30 AM by José Roca »