swape.net alireza balouch

1Mar/090

rsync

I sync my picture folders and my music and documents to my backup server via rsync.
I use ssh on my server. Rsync is fast way of syncing my files.

Here is the commend line

  1. rsync -vrutzp --exclude=.DS_Store -e "ssh -p 22" /Users/swape/Sites me@myserver.com:/home/mysite

I use:

  • (--exclude=.DS_Store) to exclude the mac files
  • (-e "ssh -p 22") to use SSH port 22
  • (/Users/swape/Sites) my local directory
  • (me@myserver.com:/home/mysite) my server
  • (-v) verbose mode to see the output
  • (-r) recursive into directories
  • (-u) using update mode
  • (-t) preserve modification times
  • (-z) compress file data during the transfer
  • (-p) preserve permissions

After writing this to my console I enter the password for my server and its done!

This is the fastest way of updating my site from my local disk.
The good thing about this that I use -u so it does not upload the files that have not been changed on my local disk. You can also drop the -v and make an Automator app but then you have to make the public key for your ssh connection so you don't have to enter the password each time you running the app.

Here is a link to manual on how to make public key http://sial.org/howto/openssh/publickey-auth/

And this is the rsync manual http://samba.anu.edu.au/ftp/rsync/rsync.html

blog comments powered by Disqus