Pierre Trudel
Pierre Trudel

Reputation: 5

Rsync -- exclude a directory but include specific subdirectories within that directory

I have read this but for some reason it doesn't work for me.

I want to exclude /jails folder but include /jails/web/usr/local/www. (and all other folders in the root directory).

--include=jails/web/usr/local/www --exclude='jails/'

but it's not working. it completely excludes the jails folder.

Thank you.

Upvotes: 0

Views: 735

Answers (1)

Gus
Gus

Reputation: 16017

I had the same problem and I managed to fix it by adding a trailing slash to the include and a trailing asterisk to the exclude, like so:

--include="jails/web/usr/local/www/" --exclude="jails/*"

Also apparently the order of the arguments matter, since putting --exclude first did not seem to work.

Upvotes: 1

Related Questions