Posted By

wnasich on 12/05/09


Tagged

sync folders


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

glenelg
k23


Sync two folders with rsync


 / Published in: Bash
 

Syncronize a local folder with a remote folder.

  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  

You need to login to post a comment.