I am trying to synchronize a folder over ssh using rsync. In particular, I only want to get the png fils in the remote folder, as all the folder may occupy several gigas. The folder structure is the following


I have tried the following rsync command rsync -avzhe ssh --progress --include='**.png' --exclude='*' user@remoteserver:/path/ .

but the output is only

receiving incremental file list

sent 39 bytes  received 60 bytes  28.29 bytes/sec
total size is 0  speedup is 0.00

and nothing in synchronized.

What would be the correct way to achieve this?

1 Answer 1


You will have to tell rsync to include directories:

rsync -av --progress --include='*/' --include='*.png' --exclude='*' source/ target

... otherwise it won't even go down into any of the test_* directories.

You can see the matching of names against patterns if you add more -v options to the command.

I've also deleted the -e ssh option as rsync uses SSH by default, and the -z option as compression would not help with transferring PNG images to any greater extent (using compression with rsync at all is really only useful over extremely slow links).

You must log in to answer this question.

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