| @@ -0,0 +1,25 @@ | |||
| 1 | + | # rsync | |
| 2 | + | ||
| 3 | + | * rsync saving ACLs and xattrs: | |
| 4 | + | ||
| 5 | + | `rsync -avPAX` | |
| 6 | + | ||
| 7 | + | * rsync only files less than $x days old preserving directory path on remote host: | |
| 8 | + | ||
| 9 | + | `find . -type f -mtime -4 -print0 | rsync -0adv --files-from=- ./ root@target-host:/target/path/` | |
| 10 | + | ||
| 11 | + | * rsync files created in the last 30 days: | |
| 12 | + | ||
| 13 | + | `rsync -avP --files-from=<(find . -type f -mtime -30 -exec basename {} \;) $(pwd)/ root@target:/path/` | |
| 14 | + | ||
| 15 | + | * rsync with spaces in path (-s = protect-args): | |
| 16 | + | ||
| 17 | + | `rsync -avPs root@target:/path/to/'a file' /destination/` | |
| 18 | + | ||
| 19 | + | * rsync full system backup: | |
| 20 | + | ||
| 21 | + | `rsync -chavzP --rsync-path="sudo rsync" --stats --exclude /dev/ --exclude /proc/ user@source:/ .` | |
| 22 | + | ||
| 23 | + | * rsync only selected directories: | |
| 24 | + | ||
| 25 | + | `rsync -avP --include 'dir1/***' --include 'dir2/***' --exclude '*' /tmp/test/ root@remote:/tmp/test/` | |
simon revised this gist 1 month ago · b16c336
1 file changed, 25 insertions