返回最后訪問指定文件或文件夾的日期和時間。只讀。
object.DateLastAccessed
object 應為 File 或 Folder 對象。
下面的代碼通過一個文件說明了 DateLastAccessed 屬性的用法:
[JScript] function ShowFileAccessInfo(filespec) { var fso, f, s; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.GetFile(filespec); s = filespec.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 = UCase(filespec) & "<BR>" s = s & "Created:" & f.DateCreated & "<BR>" s = s & "Last Accessed:" &f.DateLastAccessed
& "<BR>" s = s & "Last Modified:" & f.DateLastModified ShowFileAccessInfo = s End Function
注意 這個方法的操作依賴于底層的操作系統(tǒng)。如果操作系統(tǒng)不支持提供時間信息,那么將不會返回任何信息。
Attributes 屬性 | DateCreated 屬性 | DateLastModified 屬性 | Drive 屬性 | Files 屬性 | IsRootFolder 屬性 | Name 屬性 | ParentFolder 屬性 | Path 屬性 | ShortName 屬性 | ShortPath 屬性 | Size 屬性 | SubFolders 屬性 | Type 屬性