ASP DateLastAccessed 属性

定义和用法

DateLastAccessed 属性用于返回指定的文件或文件夹最后被访问的日期和时间。

语法:

  1. FileObject.DateLastAccessed
  2. FolderObject.DateLastAccessed

针对 File 对象的例子

  1. <%
  2. dim fs,f
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set f=fs.GetFile("c:\test.txt")
  5. Response.Write("File last accessed on: ")
  6. Response.Write(f.DateLastAccessed)
  7. set f=nothing
  8. set fs=nothing
  9. %>

输出:

  1. File last accessed on: 8/8/2008 10:21:23 AM

针对 Folder 对象的例子

  1. <%
  2. dim fs,fo
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set fo=fs.GetFolder("c:\test")
  5. Response.Write("Folder last accessed on: ")
  6. Response.Write(fo.DateLastAccessed)
  7. set fo=nothing
  8. set fs=nothing
  9. %>

输出:

  1. Folder last accessed on: 8/8/2008 10:01:19 AM