Vbscript Follow

0
Avatar
Legacy Poster

I am trying to adding to this Script so it will also search and copy files from the source directories Subfolders also. Currently it only copies from the Scource Folder. 

 

Dim SOURCE, TARGET, fso, SourceObj, TargetObj, FileObj
SOURCE = "C:\Users\1385741622A\Desktop\Current 68's"
TARGET = "C:\Users\1385741622A\Desktop\Due 68's\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceObj = fso.GetFolder(SOURCE)
For Each fileObj in SourceObj.Files
    If (InStr(1, FileObj.Name,"AF68-",vbTextCompare) = 1) And _
            (DateDiff("d", fileObj.DateLastModified, Now) > 10) Then
        fileObj.Copy (TARGET)
    End If
Next

Please sign in to leave a comment.