Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jrock2004

macrumors 6502
Original poster
May 4, 2008
375
0
PA
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.

Code:
/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

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

Any thoughts on what I am doing wrong here? Thanks
 
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?
 
Ok so I looked closer in the man pages and I have found

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

That works.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.