Go away or I will replace you with a very small shell script, actually,,, hang around dude....
March 13, 2008 7:38 PM   Subscribe

Anyone know of a backup script or utility that won't hurt the OLD copy?

Is there any software/script for this situation:

I have two hard drives / directories, one a master backup (A) which is out-of-date, the other is the drive I work with day to day (B).

I'd like to copy/move all the files from B to replace the out-of-date versions on A. However. if I just copy the root directory I lose anything that was on A but not B.

Sort of like a CVS update, but CVS has not been setup previously. like this:
for all files on B
if (file exists on A)
replace A's copy with B's
add it

and don't touch any file/dir that's on A but not B.

I've run into this need twice this week and while probably trivial to script out it seems like a need others would have had too, so maybe re-inventing the wheel to write it? (plus I suck at batch scripting)

I can't find the key words to google for it, but this has to exist for unix and windows, right? A handy free backup app that has this feature through configuration would be of great interest too.
posted by oblio_one to Computers & Internet (9 answers total) 1 user marked this as a favorite
Best answer: rsync --existing --update a/ b
posted by nicwolff at 7:54 PM on March 13, 2008

Response by poster: thanks! knew it had to be simpler then I was making it.
posted by oblio_one at 8:12 PM on March 13, 2008

Whoops, add --recursive or it won't do much :/
posted by nicwolff at 8:16 PM on March 13, 2008

Wait, now I'm not sure what you were asking. You want to make the backup A have all files that are on B without deleting any that are on A but not on B - then I have A and B backwards, and you don't want --existing, just

rsync --update --recursive B/ A

Hope you didn't do this without testing! Sorry.
posted by nicwolff at 8:22 PM on March 13, 2008

(And, with --update I'm assuming that you don't want to write over files on the backup if they're newer than a file with the same name at the same location on the source, but maybe you do, for instance if you reverted a library.)
posted by nicwolff at 8:24 PM on March 13, 2008

Response by poster: heh, I thanked and favorited you after scanning the man page, no worries about testing. You've given me that keyword to search and that was what I was most thankful for.

Anyone with a word on windows solution? or and useful app in general? might as well make the most of my question.
posted by oblio_one at 8:50 PM on March 13, 2008

There are many rsync wrappers for windows, or SyncToy does pretty much the same thing.
posted by chrisamiller at 9:43 PM on March 13, 2008

Ooo! Ooo! I just registered a project to do this a month ago. It uses rsync in the back end. If you use a filesystem that supports file "links", then you get full numbered snapshots but you only use additional disc space for files that change; my filesystem is EXT2 because I use Linux, but I hear NTFS supports "hard links" too. The upshot is that I have 60 directories on my extra disc, each one representing a different day, each looking like a full copy of my stuff -- all fitting on a disc that is only twice as big as the source, not 60 times as big. If I want to see what things were like two weeks ago, I go look in 14/ .

You can get v0.5 at
or track its progress at https://code.launchpad.net/rsnap

Alternatively, you can use the same mechanism I use. Shift the numbers up one, and then create a new zero dir:
deltree 5
rename 4 5
rename 3 4
rename 2 3
rename 1 2
rename 0 1
rsync --archive --numeric-ids --link-dest=../1 c:/ 1
...or something like that -- my DOS skills are very rusty.

I'd love to know that rsnap works on Windows. Ping me if you're interested.
posted by cmiller at 2:29 AM on March 14, 2008 [1 favorite]

Try Allway Sync at http://allwaysync.com I love this program, as you can configure multiple directories with different sync options. It is free for very limited backups and cheap for a licensed version. They are very nice people and very helpful with upgrades etc.
posted by sgmax at 6:40 PM on March 14, 2008

« Older Using a camera as a card writer in XP. Possible?   |   [it stands for getting my own fucking blog] Newer »
This thread is closed to new comments.