简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM