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

高洛峰
Release: 2017-01-16 10:22:50
Original
1718 people have browsed it

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
Copy after login

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
%>
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template