howto rsync current directory with remote server over ssh Dec 19 2004

This will upload the new files using SSH from the current directory and synchronize with the remote directory public_html on HOST, pushing only the new or changed files.

rsync -rvC --rsh="ssh -l SSH_USERNAME" * HOST:public_html/

mmmm, tasty rsync. my new best friend. even better than scp, I think.

From man rsync:

-C, –cvs-exclude

This is a useful shorthand for excluding a broad range of files that you often don’t want to transfer between systems. It uses the same algorithm that CVS uses to determine if a file should be ignored.

The exclude list is initialized to:

RCS/ SCCS/ CVS/ .svn/ CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,* *.old *.bak *.BAK *.orig *.rej .del-* *.a *.o *.obj *.so *.Z *.elc *.ln core

then files listed in a $HOME/.cvsignore are added to the list and any files listed in the CVSIGNORE environment variable (space delimited).

Finally, any file is ignored if it is in the same directory as a .cvsignore file and matches one of the patterns listed therein.

See the cvs(1) manual for more information.

I just created a nice little .cvsignore file in my $HOME directory with the following in it:


so that in addition to not uploading Subversion or CVS directories, the .DS_Store files that my Mac puts in directories won’t get uploaded when i rsync. SWEEET! 🙂


Leave a Reply

sell diamonds