I need to copy files from one location to another location, but only copy new files, or files that have changed.
For instance, I have data in C:\Working which includes folders and files. The files are changed, and removed from there as they are no longer needed or a project is complete.
I need a batch file to move everything in that location to D:\Storage. Since some files may not have changed, I do not want to copy those, however, I do want to copy and replace files that have been modified.
I believe I can use Robocopy /E and that will give me the recursion that I need. I am not sure on how to check hashes or stamps to verify if the file has been changed. I know I can EXCLUDE files with the /XC, but I think that's the opposite of what I want.
Right now my file as as folows:
@echo off
pushd C:\Working
>nul Robocopy /E . D:\Storage
popd
Edit: I don't want to just copy everything because the working location may have upwards of 60GB in it, and only 1-2GB needs to be copied.
http://ss64.com/nt/robocopy.html
By default Robocopy will only copy a file if the source and destination have different time stamps or different file sizes.
Therefore, Robocopy . D:\Storage /E should be fine. You may want to add the /XO option depending on what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With