0

I'm using rsync to transfer a directory to another location: rsync -av ./ /var/www/html/some_project --exclude-from=ignore_these.txt

In the current directory, I have a subdirectory named testing and a file named config.json

Deeper within the current directory, I have another subdirectory named testing and another file named config.json

I want the rsync transfer to exclude ./testing and ./config.json but include every other occurrence that may exist.

I'm using an exclusion file:

- ignore_these.txt
- testing
- config.json

Using this exclusion file, all testing and config.json items are excluded. If I prefix each with ./ then none are excluded bc. nothing ever matches ./testing etc. I cannot explicitly "include" the sub-config.json nor sub-testing as this will not be maintainable as the project grows.

How do I exclude only the files/directories located within the CWD?

1 Answer 1

1

This should exclude the first level {prova1,prova3} files in the first level directory and then include the same files in the deeper levels:

rsync -av --include={\*/prova1,\*/prova3} --exclude={"prova1","prova3"} aa/ bb/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .