Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've just recently revisited a script that I maintained a few years back and trying to get it to work on a new server.

It basically runs the following

rsync -vaP --copy-unsafe-links --files-from=dirlist.txt --exclude-from=excludelist.txt . /path/to/backup

dirlist.txt is a plain text file that contains directories with files I want synced relative to .

foo/
foo/bar
foo/bar/gop
foo/tra
foo/bla
foo/bla/rgh
foo/bla/rgh/meh

and excludelist.txt is a plain text file that contains the path to specific files within the above directories that I want to exclude from the rsync command.

When I run the above I get

/path/to/backup/foo
/path/to/backup/foo/bar
/path/to/backup/foo/bar/gop
/path/to/backup/foo/tra
/path/to/backup/foo/bla
/path/to/backup/foo/bla/rgh
/path/to/backup/foo/bla/rgh/meh

But none of the files that were in the source directory were copied over?

I've tried using the -r command but then I end up getting directories that I don't want like foo/don or foo/tco copied when it runs the rsync for foo/.

I know this script has run in the past so I'm very confused as to what has changed (other then maybe the rsync version but I can't track down the version I had last ran on).

Update: I'm using various versions of rsync from 2.5.7 to 2.6.6. In 2.5.7 it doesn't have --files-from nor --Filter

share|improve this question
    
Version 2.6.8 of rsync appears to do what I wanted without any additional changes. –  colekas Aug 16 '11 at 18:52

1 Answer 1

I had a similar problem a while ago.

My solution was to opt for the filter rule as follows:

rsync --archive -r --filter="merge fromfile" --dry-run

fromfile
- /el[2-4]*
- "*/ppc/*"
+ /el5
- /*

This excludes any sub directories named ppc, any top level directories el2, el3, el4, includes el5 and excludes everything else.

share|improve this answer
    
I'm merging the dirlist.txt and excludelist.txt into one list? –  colekas Aug 16 '11 at 16:54
    
This also seems to be an issue resolved with 2.6.6 of rsync. Unfortunately I only have one machine that runs this version. –  colekas Aug 16 '11 at 17:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.