Hi,
I want to copy files from an array to a destination folder, I also want to check the date as well.
I tried the following script and get an error: Expected end of statement
I want to copy files from an array to a destination folder, I also want to check the date as well.
I tried the following script and get an error: Expected end of statement
Code:
Dim FilesToCopy As String
Dim sCopy() As String
Dim i As Integer
FilesToCopy = "file1.csv,file2.csv,file3.csv"
bPath = "C:\Temp\Test2\" 'DESTINATION PATH
aDate = CDate("01-JAN-2010") 'FILES CREATED AFTER THIS DATE
'CREATE FILESYSTEM OBJECT
Set FSO = CreateObject("Scripting.FileSystemObject")
sCopy = Split(FilesToCopy, ",")
For i = 0 To UBound(sCopy)
If file.DateCreated > aDate Then
'then copy the file to destination folder
file.Copy bPath ^& file.Name
End If
Next