Sync two folders with rsync


/ Published in: Bash
Save to your folder(s)

Syncronize a local folder with a remote folder.


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2. REMOTE_FOLDER="/path/to/remote/folder/"
  3. LOCAL_FOLDER="/path/to/local/folder/"
  4. SSH_USER="user"
  5. SSH_HOST="remote-host"
  6.  
  7. DRY="--dry-run"
  8. if [ "$1" == 'write' ]; then
  9. DRY=" "
  10. fi
  11. echo $DRY
  12.  
  13. rsync $DRY -av -e ssh --exclude "CVS" --exclude ".svn" $SSH_USER@$SSH_HOST:$REMOTE_FOLDER $LOCAL_FOLDER

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.