Place Holder Projects Code
Bash MySQL JavaScript MySQL Quick Reference
Notes Documents Return of the Fed Login

Remote Synchronization with rsync and Exclusion

rsync rocks.  Here, we'll use it to 'synchronize' a remote folder with a local one, while excluding a couple files.  rsync can even pick up where it left off if interrupted, and it won't overwrite data unnecessarily!

Here's the general form of local -> remote:

rsync -avh --exclude 'path/to/exclude' --exclude 'path/to/exclude2' /path/to/source user@server:/path/to/remote/dest

-a for 'archive', which is rsync shorthand for "recursion" and "preserving almost everything", -v for verbose, -h for human readable numbers.  --exclude excludes files from transfer and is relative to the source path!.

There are a million ways to use rsync, and lots of flags.  A couple of others I've found useful include -P for showing progress, -z to enable compression, --delete which provides a powerful destructive updating ability, and --dry-run to safely test the command.