Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Last active December 13, 2019 05:14
Show Gist options
  • Save chrisjlee/3416854 to your computer and use it in GitHub Desktop.
Save chrisjlee/3416854 to your computer and use it in GitHub Desktop.
rsync example
#!/bin/bash
# -r recursive
# -z use compression - turn this off if server need to conserve memory
# -t preserve modification times
# -p preserve permissions
# -l copy symlinks as symlinks
# Sync the files from the source to target folder and delete any extraneous folders
rsync -rvztpl --delete --stats --rsh=/usr/bin/ssh . sshalias:/var/sites/fooooobarbar.com
# Preserve files and not delete missing files
# rsync -rvztpl --stats --rsh=/usr/bin/ssh . sshalias:/var/sites/fooooobarbar.com
# sycn but only sync sql files
# rsync -rvztpl --stats --include "*.sql*" --exclude="*" --rsh=/usr/bin/ssh ec2:/home/ubuntu/db .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment