This section includes typical rsync usage examples for uni-directional replication, as well as the functionally equivalent async command.
WARNING: If you do not include a drive letter in your path when syncing with a Windows machine, async will report the following error message: "Failed. Peer error: Remote directory is not absolute." Thus, remember to always include a drive letter in your Windows path(s).
IMPORTANT NOTE: You can synchronize between a Linux endpoint and a Linux server, as well as between a Linux endpoint and a Windows server. In async, the path separator "/" works equally well on Windows and other platforms. The path separator "\" is platform-agnostic ONLY for the options -d/r/L/R/B/b and --keep-dir-local/remote. In filtering rules, however, "\" is exclusively a quoting operator and "/" is the only path separator recognized. The examples below use "/" uniformly.
Example 1
Requirements:
- Recursively synchronize the contents of a directory to the remote system
- Preserve access and modification time stamps on files
- Preserve the owner and group ID
- No encryption
- Transfer policy = fair
- Target rate = 100,000 Kbps (100 Mbps)
- One time transfer (not continuous)
rsync command:
$ rsync --stats -v -r -u -l -t -o -g -p /media/ editor@docserver:/backups/media
async equivalent:
$ async -N Oneway -u -t -j -d /media/ -r editor@docserver:/backups/media -l 100M -w d0c5 -K push -c none
Example 2
Requirements:
- Recursively synchronize the contents of the directory /media/wmv/
- Exclude "." files within the directory
- Exclude all other directories
- Preserve the owner and group ID
- Preserve access and modification time stamps on files
- No encryption
- Transfer policy = fair
- Target rate = 100,000 Kbps (100 Mbps)
- One time transfer (not continuous)
rsync command:
$ rsync --stats -v -r -u -l -t -o -g -p /media/ --include="/media" --include="/media/wmv" --exclude="/media/.*" editor@docserver:/backups/media
async equivalent:
$ async -N Oneway -u -t -j -d /media/ --include="/media" --include="/media/wmv" --exclude="/media/.*" -r editor@docserver:/backups/media -w d0c5 -K push -c none
Options Comparison Table
rsync Option | async Option | Description |
---|---|---|
--stats | Enabled, by default (i.e., not quiet) | File transfer stats |
-v, --verbose | Enabled, by default | Increase verbosity |
-q, --quiet | -q, --quiet | Disable progress display |
-r, --recursive | Enabled, by default | Recurse into directories |
-u, --update | If a file exists at the destination with the same name, then async's default behavior is to do nothing if the files are the same (size and checksum), and overwrite if the file is different. | Skip files that are newer on the receiver |
-l, --links | -n COPY, --symbolic-links=COPY (default) | Copy symlinks as symlinks |
-t, --times | -t, --preserve-time (must have ES, CS or P2P 3.1+ installed) | Preserve modification times |
-o, --owner | -u, --preserve-uid | Preserve owner |
-g, --group | -j, --preserve-gid | Preserve group |
-p, --perms | With regard to directory attributes, if the source mode doesn't have sufficient owner permissions, then the destination will add: owner rwx. | Preserve permissions |
--version | -A, --version | Print version number |
-h, --help | -h, --help | Show help |
--include-from=FILE | -I, --include-from=FILE | Include filter (text file with paths for inclusion). See Include/Exclude Filtering Rules. |
--exclude-from=FILE | -E,--exclude-from=FILE | Exclude filter (text file with paths for exclusions). See Include/Exclude Filtering Rules. |
--include=PATTERN | --include=PATTERN | Include paths that match PATTERN. See Include/Exclude Filtering Rules. |
--exclude=PATTERN | --exclude=PATTERN | Skip paths that match PATTERN. See Include/Exclude Filtering Rules. |
-c none | rsync, as a protocol, does not encrypt on its own; however, rsync can enable/disable the SSH encryption protocol (using option -e ssh). |