Rsync filter – copy pattern only

To copy only let’s say *.pdf, include directories containing them, and exclude everything else.

rsync -avzhm --include='*.pdf' --include='*/' --exclude='*' /directory/src/ /directory/dst

Note that this copies only directories, that contain matching file or subdirectory containing one.

Leave a Reply

Your email address will not be published. Required fields are marked *

*