Home >Web Front-end >JS Tutorial >How to get the creation time, last modification time and last access time of a file in vbscript

How to get the creation time, last modification time and last access time of a file in vbscript

高洛峰
高洛峰Original
2017-01-16 10:22:501700browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn