Computer Hope
Microsoft => Microsoft DOS => Topic started by: elimenohpee on June 14, 2010, 08:42:43 PM
-
I'm trying to write a .bat file (I just started learning msdos and scripting tonight so bear with me) that will backup/copy any new files placed on my jump drive onto my home computer. To do this, right now I'm just running a xcopy command from the command line. However, is there a switch that will tell dos not to copy if the file already exists and hasn't been modified? I was able to copy all the files, but I thought it might be time consuming if everytime I plug it in it has to copy the ENTIRE jump drive, instead of the new files.
/U seems to have exactly what I need, just opposite :)
Thanks for any help
-
Have a look at the Xcopy /M switch.
Hope this helps.
-
That didn't seem to work, it still asks me if I'd like to overwrite the file, which I don't. Right now I'm using this as the script, which gets the job done, it just takes about 2 minutes to sync everything up.
@echo off
xcopy e:\jumpdrive c:\documents /s /m
xcopy c:\documents e:\jumpdrive /s /m
I'd like it to only copy new files, instead of copying 533 files (last run) each time it executes. The switch /y seems like it should work, but it tells it to overwrite it, which is opposite of what I actually want also.
-
Figured it out. If you use the switch /d without a date specified, it will copy only files that have changed at some point. Works perfectly now.