- May
- 120
- 1
I want to back up a directory to a second drive. Basically, I want to
copy all changed files, delete any removed files, but avoid copying
more than necessary. Essentially, the equivalent of RD /S /Q dest &
COPY /S src dest, but without copying unchanged files. This seems like
a common enough task, but I'm finding it hard to get the correct
command.
COPY /S /C src dest nearly does it, but doesn't delete any files
removed from src.
SYNC /S /W src dest also nearly works, but if a file in dest is
modified, it copies it back.
My best option so far is SYNC /S /W, and try to ensure that the
destination files are never modified. But as this is for backup
purposes, I'm a bit nervous. COPY /S /C isn't really useful, as if I
use this for a relatively volatile directory (my working directory,
for instance) the backup will grow indefinitely with stuff that I
tried for a while then deleted.
Have I missed any good options? (Hmm, I keep hearing good things about
the MS ROBOCOPY utility - maybe I should look at that. Does anyone
know if that would help me?)
Paul.
copy all changed files, delete any removed files, but avoid copying
more than necessary. Essentially, the equivalent of RD /S /Q dest &
COPY /S src dest, but without copying unchanged files. This seems like
a common enough task, but I'm finding it hard to get the correct
command.
COPY /S /C src dest nearly does it, but doesn't delete any files
removed from src.
SYNC /S /W src dest also nearly works, but if a file in dest is
modified, it copies it back.
My best option so far is SYNC /S /W, and try to ensure that the
destination files are never modified. But as this is for backup
purposes, I'm a bit nervous. COPY /S /C isn't really useful, as if I
use this for a relatively volatile directory (my working directory,
for instance) the backup will grow indefinitely with stuff that I
tried for a while then deleted.
Have I missed any good options? (Hmm, I keep hearing good things about
the MS ROBOCOPY utility - maybe I should look at that. Does anyone
know if that would help me?)
Paul.