Wednesday, April 22, 2009

Syncronize Working Directories With Rsync

I got tired of always searching all over the internet for the commands and tutorials that I use all of the time. I finally decided that I would start a blog where I kept track of all of the useful tips and tricks that I have found on the internet.

rsync -avz -delete -progress -e 'ssh -p 222' local_folder/ user@host.com:/var/www/remote_folder/

Let's review the command. -a=archive, -v=verbose, -z=compress -e=work over ssh using port 222, --stats=extra statistics followed by the source and destination. The dot stands for the current directory.

Rsync has the advantage over scp by only copying files that have changed. This is really great when you have only changed a few files in a large directory.