Home >Web Front-end >JS Tutorial >How to get the creation time, last modification time and last access time of a file in vbscript
set fso=createobject("Scripting.FileSystemObject") set fn=fso.GetFile("E:\AD.txt") msgbox "文件创建时间:"&fn.DateCreated msgbox "文件最后修改时间:"&fn.DateLastModified msgbox "文件最后访问时间:"&fn.DateLastAccessed set fn=nothing set fso=nothing
FileSystemObject Object Introduction:
The FileSystemObject object is used to access the file system on the server. This object operates on files, folders, and directory paths. File system information can also be obtained through this object.
The following code will create a text file (c:\test.txt), and then write some text to this file:
<% dim fs,fname set fs=Server.CreateObject("Scripting.FileSystemObject") set fname=fs.CreateTextFile("c:\test.txt",true) fname.WriteLine("Hello World!") fname.Close set fname=nothing set fs=nothing %>
More vbscript gets the creation time, last modification time and last access of the file For articles related to time methods, please pay attention to the PHP Chinese website!