All files in C:\Temp\ that are < 1 older than day will be copied to C:\Temp\1\.
in this case i consider C:\Temp\1\ a temporal transition folder should be freed after copy is done.
From_folder = "C:\Temp\"
To_Folder="C:\Temp\1\"
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim folder, file
Dim parts, file_date
Set folder = fso.GetFolder(From_folder)
For Each file in folder.Files
If DateDiff("d", file.DateCreated, Now()) < 1 Then
'MsgBox file.DateCreated
fso.CopyFile From_folder & file.name, To_Folder & file.name
fso.DeleteFile From_folder & file.name, true
End If
next
Tuesday, July 20, 2010
Subscribe to:
Posts (Atom)