PDA

View Full Version : Rsync backup script




jrock2004
Jan 19, 2012, 08:17 AM
I am working on an rsync backup script and I cannot get includes and excludes to work properly. I basically want to exclude everything except some things I want to backup. I created an include.txt file and it I started with just one file.


/Users/johnc/test.txt


I am trying to run the command outside of the script to get it to work first, but here it is


rsync -av --include-from 'include.txt' --exclude '*' / /Volumes/Backup


Any thoughts on what I am doing wrong here? Thanks



chown33
Jan 19, 2012, 09:52 AM
A file containing a list of the exact files to sync sounds exactly like the --files-from=FILE option.
To me, that suggests any use of --include-from or --exclude would be wrong, and could cause a malfunction, such as things being excluded or included that aren't in the file-list.

Furthermore, --include-from is not for a list of files to include, but patterns to include. A pattern is not the same as a filename.

Finally, without trying it, your pattern options don't follow the way options are shown in the man page.
The man page shows --exclude=PATTERN, which is not the same as --exclude PATTERN.
Equals-sign is not space.


I gathered the above simply by a quick browse of rsync's man page, looking specifically at the options you show.

Did you come up with your command-line by following an example found on the web, or some other source? If so, what is the URL?

jrock2004
Jan 19, 2012, 10:34 AM
Ok so I looked closer in the man pages and I have found


rsync -av --files-from='includes.txt' / /Volumes/Backup/


That works.