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 had to break my rsync tasks down into smaller jobs given the size of my directories. Essentially, I'm doing it alphabetically (i.e., script that syncs folders starting with A-D, E-H, etc, etc).

The issue I'm having is this.....my A-D filter.txt file works fine, but all of the others fail. I believe the issue is because the path that I'm syncing is:

/AUser/db/Backups/***
/AUser2/db/Backups/***
/CUser/db/Backups/***
/EUser/db/Backups/***

My filter.txt file for A-D looks like this:

- E*
- e*
- F*
- f* (etc all the way through Z)
+ */db/
+ */db/Backups/***
- *

The one above works with no issue. However, this one does not:

- A*
- a*
- B*
- b* 
- C*
- c*
- D*
- d*
- I*
- i*
- J* (etc all the way through Z)
+ */db/
+ */db/Backups/***
- *

I'm guessing my exclusion of either d or B is causing this (it's excluding the db folder or the Backups folder??) but I can't figure out why since I have an include for */db/ and /db/Backups/**

Thank you!!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

rsync filters work on the first match that is found - so yes, your excludes of "d*" and "B*" are excluding your "db" and "Backups" subdirectories before your include matches.

You'd be better off just including the specific paths you want included, and then excluding everything else, e.g.:

+ /[E-H]*            # include top-level dirs starting with E through to H
+ */db/              # include "db" subdirectories
+ */db/Backups/      # include "db/Backups" subdirectories
- */                 # exclude all other directories
share|improve this answer
    
Worked perfectly - thank you! –  Jason Feb 25 '13 at 15:02

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.