I'm looking for an alternative to using this, it doesn't have to use FTP, but it should provide the same functionality as the "--mirror" option of wget where it only downloads new and changed files.

wget --mirror --preserve-permissions --directory-prefix=/hdd2/website-backups --exclude-directories=special,stats --ftp-user=user --ftp-password=pass ftp://ftp.domain.com

Currently the above command is how a remote site is being backed up every few days via cron job on a home server. The remote site has moved to a new host with SSH available and I've already got public/private keys setup for SSH. Now I would like to use something a little more secure than wget/ftp for the automated backup, but since this site has a lot of image files most of which will not change, I don't really want to zip up the entire documentRoot and download it every time.

link|improve this question
feedback

1 Answer

up vote 8 down vote accepted

rsync is the standard utility for this:

rsync -avz -e ssh source/ user@destServer:/dest/
  • a For archive, keeps permissions, type stamps, etc.
  • v for verbose
  • e ssh , use over ssh
  • z for compression, if you want that. It won't try to re-compress archive (zip) files.

rsync generally comes with Linux distributions. It also meets your requirement of not transferring things that have not changed.

link|improve this answer
Welcome to the 10k club! – womble Oct 27 '09 at 14:02
Why thank you womble :-P – Kyle Brandt Oct 27 '09 at 14:03
2  
+1 for rsync. Here are a few useful rsync flags: when you are running rsync interactively (mostly during testing) use the --progress flag. Some informative statistics can be gathered by using the --stats flag. Also, if you dont want rsync to hog all of your bandwidth you can limit its download rate by using --bwlimit=KBPS KBytes per second. I also find it useful to use the -e parameter when I have to use a nonstandard ssh port like this -e" ssh -p 10222" – faultyserver Oct 27 '09 at 15:54
Mention of the -e flag when non-standard ports are being used also definitely comes in handy. :) – joebert Oct 27 '09 at 18:51
feedback

Your Answer

 
or
required, but never shown

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