Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by fretje, Ivo Flipse Jan 22 '10 at 7:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

8 Answers 8

up vote 3 down vote accepted

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.

share|improve this answer

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

share|improve this answer

I would do it with a batch file.

share|improve this answer
    
ah! yes or a rake task :) –  banister Aug 22 '09 at 3:51

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

share|improve this answer

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

share|improve this answer

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/
share|improve this answer
1  
+1 and sorry for changing the tags of the question to Windows. ;-) –  Arjan Aug 22 '09 at 11:08
    
see my answer for a link to a windows port of rsync ;-) –  The Tentacle Aug 22 '09 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 '09 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 '09 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 '09 at 15:19

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).

share|improve this answer

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

share|improve this answer
    
Link dead, pgbovine.net/unison-for-your-mom.htm is probably the same. –  hlovdal Mar 18 at 15:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.