2

Possible Duplicate:
Which is the best application to Sync two folders?

Hi

I have an unreliable computer but a large USB drive. What is the best way to setup a system where certain directories/files on my computer are sync'd to the USB drive as a backup.

I do not want the backups to happen automatically when i plug in the USB, but only when i run a command. :D

anyone have a solution for this?

2
  • 3
    Can you specify your operating system?
    – John Fouhy
    Aug 22, 2009 at 4:28
  • Given the accepted answer, let's assume it's Windows...
    – Arjan
    Aug 22, 2009 at 11:06

8 Answers 8

3

A batch itself is not much use, you'd need to use the copy or xcopy command to actually do the backup/sync.

However there are known problems with copy and xcopy (failing on long file paths, locked files etc) so instead I would advise using Robocopy which is part of the Windows 2003 resource kit tools download.

Then you call it from a batch file. As an example to do a standard backup I use:

robocopy "C:\Documents and Settings" "Y:\Backups\EEEPC900HA\Documents and Settings" /s /e /zb /copyall /log:%logfile% /tee /ndl /r:0 

This command copies all files and folders that are new or have changed from "C:\Documents and Settings" to my external backup drive. Locked files will be skipped and it will not re-try to speed things up. Long paths/filenames are handled correctly.

Robocopy can do both a standard backup (one way) or a "Sync" where both folders are kept identical. You can also exclude from the backup certain files and folders using wildcards.

The only thing Robocopy doesn't really give you is shadow copying of locked files (it just skips locked files). But only a few tools do, and it requires the shadow copy service to be running.

My backup process is simply a shortcut on the desktop calling the Robocopy batch file. I just plug in my drive and double-click the shortcut. Backing up 40 GB of files takes a while the first time, but subsequently only new/changed files are copied so it only takes on average about 30 seconds.

2

I recommend Synctoy 2.0. You can set up various sorts of sync relationships. It can either be scheduled or run on demand.

1

I would do it with a batch file.

1
  • ah! yes or a rake task :)
    – horseyguy
    Aug 22, 2009 at 3:51
1

install the free software called "Unison". It's great for backing up and syncing files and folders

1

I would recommend the SyncBack software (SE or PRO)... It does quite a good job.

1

I use rsync to back up photos on Linux. The external device has several partitions so I need to find the right one first.

#!/bin/sh

target=$(ls -d /media/disk*/photos)
rsync -a --progress -r $HOME/photos/ $target/
5
  • 1
    +1 and sorry for changing the tags of the question to Windows. ;-)
    – Arjan
    Aug 22, 2009 at 11:08
  • see my answer for a link to a windows port of rsync ;-) Aug 22, 2009 at 11:33
  • However, when not using a changing value for $TARGET (with an optional --link-dest), deleting files from the original disk will also delete them from the backup? So, overwriting the same backup each time may be a bit dangerous. See blog.interlinked.org/tutorials/rsync_time_machine.html
    – Arjan
    Aug 22, 2009 at 11:49
  • Oh, I just want a sync'd copy of what's in my photos directory. I don't delete photos or do incremental backups... this is the stupidest I could make it, but ensures I actually back something up then!
    – richq
    Aug 22, 2009 at 14:30
  • @rq, I guess that makes you the only person in this world who will notice right away that some photos have been accidentally deleted, or messed up by some erroneous batch editing. And then you will restore the originals before you make a new backup... ;-) (Really, the rsync solution in the link I posted is not too hard to achieve either, though it needs manual clean-up when the back up disk is full -- which is kind of dangerous by itself.)
    – Arjan
    Aug 23, 2009 at 15:19
1

If you want very robust backup command-line tools:

rdiff-backup

What is it? rdiff-backup backs up one directory to another, possibly over a network. The target directory ends up a copy of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves subdirectories, hard links, dev files, permissions, uid/gid ownership, modification times, extended attributes, acls, and resource forks. Also, rdiff-backup can operate in a bandwidth efficient manner over a pipe, like rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up to a remote location, and only the differences will be transmitted. Finally, rdiff-backup is easy to use and settings have sensical defaults.



You can also get a windows version of the infamous rsync for windows, which one should be able to use locally IINM:

DeltaCopy



There is also Unison:

Unison

but I think rdiff-backup is a more robust and flexible technology, and not a network-centric as unison (I never used unison so can't comment).

0

This tutorial, titled "Setting up Unison for your mom", addresses this exact issue.

1

Not the answer you're looking for? Browse other questions tagged .