VBScript to detect today's modified files in a folder (including subfolders inside it)
I need to get all the modified files inside a folder including the subfolders inside it, and copy them to another folder. How can it be done using VBScript or any other way to achieve this?
开发者_如何学运维Thanks in advance,
Bibhutry this (copy files modified less than 24 hrs ago )
Set objFS = CreateObject("Scripting.FileSystemObject")
''# Directory to scan
strFolder = "c:\test"
Set objFolder = objFS.GetFolder(strFolder)
Go( objFolder)
Sub Go(objDIR)
If objDIR <> "\System Volume Information" Then
For Each eFolder in objDIR.SubFolders
Go eFolder
Next
For Each strFiles In objDIR.Files
strFileName = strFiles.Name
strFilePath = strFiles.Path
If DateDiff("h",strFile.DateLastModified,Now) < 24 Then
objFS.CopyFile strFolder&"\"&strFileName,"c:\tmp"
End If
Next
End If
End Sub
精彩评论