5

I want to rsync everything in /Volumes/B/, except for Cache directories, which I want to exclude globally. Also, I don't want to rsync any other /Volume/

I have the following exclusion file:

+ /Volumes/B/***
- Cache/
- /Volumes/*

The first and 3rd line seem to work correctly, except that rsync also picks up all Cache dirs under /Volumes/B/... ( /Volumes/B/***/Cache/ )

What am I missing?

eatloaf
  • 607
  • 1
  • 9
  • 16

1 Answers1

8

rsync reads the exclude file top down when traversing the directories.
When it visited the Caches dirs, rsync acted on the first matching pattern.
The first matching pattern was "+ /Volumes/B/*", so Cache was included.

The rule is: When having particular subdirectories, put them first.

Here 's a simple step by step explanation.

Joao Figueiredo
  • 3,120
  • 3
  • 31
  • 40