Reputation: 109
Between web server environments we have data asset folder structures similar to the below:
/Volumes/data-acct/assets/
├── audio
│ ├── section1
│ │ └── nested files and folders
│ └── section2
├── css
│ ├── section1
│ │ └── nested files and folders
│ └── section2
├── images
│ ├── section1
│ │ └── nested files and folders
│ └── section2
└── videos
├── section1
└── section2
I've been trying to find an include filter that will allow me to match a particular section folder for each of the areas, although I get no results when changing from --include="*/"
(to include all folders and --include="*/section1/**/*.*"
rsync --dry-run --verbose --recursive --update --include="*/section1/**/*.*" --exclude="*" /Volumes/data-acct/assets/ /Volumes/data-live/assets/
Should I be running several commands for this? Or should I be making use of the --filters argument (which doesn't seem to be documented)
Upvotes: 2
Views: 383
Reputation: 615
I'm sure there's a good solution using rsync only (since it is very powerful), yet when in doubt I like to fall back on well known tools like so:
cd /Volumes/data-acct/assets &&
find . | # get all files
grep /section1/ | # that contain section1
grep -v videos/ | # but without videos
rsync --dry-run --verbose --recursive --update --files-from=- \
/Volumes/data-acct/assets/ /Volumes/data-live/assets/
The --files-from option allows you to create your own custom list without using any rsync filters at all.
Upvotes: 2