Sync with rsync

PHOTO EMBED

Wed Aug 04 2021 16:56:10 GMT+0000 (Coordinated Universal Time)

Saved by @dphillips #server #sync #copy

# Do not forget the trailing dash in the source and target destinaton paths!

# Synchronize current directory to server
rsync -avPh --stats --delete ./ HOST:REMOTE_PATH/
  
# Synchronize a local directory to server
rsync -avPh --stats --delete LOCAL_PATH/ HOST:REMOTE_PATH/
  
# Sync remote server with local path
rsync -avPh --stats --delete HOST:REMOTE_PATH LOCAL_PATH
content_copyCOPY

-a : archive -r : recursive -l: copy symlinks -p: keep permissions -t: keep file times -g: keep group permissions -o: keep owner permissions -D: keep device information (only as root) -v: verbose -n: dry-run --delete: remove files not present in source --stats: show transfer stats Do not forget the trailing dash in the source and target destinaton paths!