I want a batch file that will compare the last-modify
date of two different files located in two different folders. If the local file is older than the server file, I want to overwrite the local file.
All I've found yet it a comparing the files with the dir
command, which only works when both files are in the same folder (eg. dir /b /OD file1.txt file2.txt
).
This is what I got actually, just need to add the comparison:
set "source=\\server\myApp.otm"
set "target=%userprofile%\Application Data\myApp\"
copy /Y /B "%source%" "%target%"
start outlook.exe /altvba "%target%\myApp.otm"
As you can see, the batch file is here to start Outlook with the VBA *OTM* file in parameter. I don't want to copy the 10MB file from the server each time if it isn't needed, thus the need for a comparison of last-modify
dates (filesize
would be okay too I guess).