SoFunction
Updated on 2025-03-10

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

Copy the codeThe code is as follows:

set fso=createobject("")
set fn=("E:\")
msgbox "File creation time:"&
msgbox "File last modified time:"&
msgbox "File Last Access Time:"&
set fn=nothing
set fso=nothing

Introduction to FileSystemObject:

The FileSystemObject object is used to access the file system on the server. This object can operate on files, folders, and directory paths. This object can also obtain file system information.
The following code will create a text file (c:\) and then write some text to the file:

Copy the codeThe code is as follows:
<%
dim fs,fname
      set fs=("")
      set fname=("c:\",true)
      ("Hello World!")
     
set fname=nothing
set fs=nothing
%>

For more information, please refer to the official FileSystemObject documentation:/zh-cn/library/aa711216