Skip to content

Instantly share code, notes, and snippets.

@benjaminblack
Last active September 22, 2015 14:16
Show Gist options
  • Save benjaminblack/e88c782d71899b654da3 to your computer and use it in GitHub Desktop.
Save benjaminblack/e88c782d71899b654da3 to your computer and use it in GitHub Desktop.
Recursively copy a remote directory with rsync
rsync --checksum --human-readable --archive --verbose --compress --partial --progress --rsh=ssh <host>:<remote-path> <local-path>
* Note: if <path> ends with /, the specified directory is not included in the copy, just its contents (recursively). I.e., to copy a remote "folder" to a local "folder", without copying the folder itself, include a trailing "/" in the remote path.
Options:
--checksum: skip based on checksum, not mod-time & size
--human-readable: output numbers in a human-readable format
--archive: archive mode; same as -rlptgoD (no -H)
-r, --recursive: recurse into directories
-l, --links: copy symlinks as symlinks
-p, --perms: preserve permissions
-t, --times: preserve modification times
-g, --group: preserve group
-o, --owner: preserve owner (super-user only)
-D: same as --devices --specials
--devices: preserve device files (super-user only)
--specials: preserve special files
--verbose: increase verbosity
--compress: compress file data during the transfer
--partial: keep partially transferred files
--progress: show progress during transfer
--rsh=COMMAND: specify the remote shell to use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment