Backup With Rsync

backup directory with rsync.

rsync -avWPHAXn --delete-excluded --filter='merge rules'   /source/ /target/

-W copy whole file (default for local transfer)
-P show progress
-H preserve hard links
-n dry-run (test only,no actual transfer)

Sample 'rules' file to exclude all except /source/dir1/a/* and /source/dir1/b/c/* from /source/dir1/

+ /dir1
+ /dir1/a
+ /dir1/b
+ /dir1/b/c
- /dir1/*

Sample Makefile:

    rsync -a /source/ /target/
    rsync -a  /target/ /source/
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License