Advertisement
metalx1000

rsync examples

Aug 23rd, 2022
1,185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. local_dir="$HOME/backups/$(date +%U)"
  4. mkdir -p "$localdir"
  5.  
  6. # '-a' for archive '-z' to compress transfer
  7. rsync -az username@remote_host:/home/username/dir1 $local_dir
  8.  
  9. #if ssh is using non-stardard port
  10. #rsync -avz -e 'ssh -p 8022' username@remote_host:/home/username/dir1 $local_dir
  11.  
  12. #to exclude folder use --exclude <folder_name>
  13.  
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement