5
Làm cách nào để sửa đổi VBScript này để chỉ trả về tên tệp mới nhất và ngày Sửa đổi lần cuối? Hiện tại, nó trả về mọi thứ được sửa đổi trong 24 giờ qua. Tôi chỉ muốn tìm tập tin mới nhất. Tôi mượn điều này từ StackOverflow, chưa phải là một thuật sĩ VBScript.Sử dụng VBScript để tìm ngày tệp gần đây nhất trong một thư mục
option explicit
dim fileSystem, folder, file
dim path
path = "C:\test"
Set fileSystem = CreateObject("Scripting.FileSystemObject")
Set folder = fileSystem.GetFolder(path)
for each file in folder.Files
if file.DateLastModified > dateadd("h", -24, Now) then
'whatever you want to do to process'
WScript.Echo file.Name & " last modified at " & file.DateLastModified
end if
next