Compare date modfied when copying files-MS Access VBA
Posted on 2012-03-29
I'm using the following code to copy all files from the Source folder to the Destination folder:
Dim sourceLocation As String
Dim destinationLocation As String
sourceLocation = "E:\Source\*.*"
destinationLocation = "E:\Destination\"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile sourceLocation, destinationLocation
I have no issues with the file copy. However, if a file contained in the Source folder already exists in the Destination folder, I would like to be able to compare the Date Modified attribute of files. In the end, if the file exists in both folders, I want to have the most current version of file in the Destination folder.
Hopefully this makes sense.
Any help is appreciated.