Excluding some files in a subfolder

What is the problem you are having with rclone?

Hello, I would like to exclude some files (.jpg, .png, .log) from the subfolder devices.
I've read the docs and it seems that multiple --exclude is the way to do it. I just don't understand if I've to use the full path or if --exclude=device/*.jpg --exclude=device/*.png --exclude=device/*.log is enough.
If I've already synced in the past, without the exclude, a new sync with exclude would remove from remote the filtered files?

What is your rclone version (output from rclone version)

rclone v1.54.1

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu Server 64bit

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync /home/myuser/myproject/storage/app/public remote:storage/app/public

device is a subfolder of public: /home/myuser/myproject/storage/app/public/device

Best regards,


Hi, welcome to the forum.

Filtering can be hard to get right. The following site is great to play around and see how your filters would work out: https://filterdemo.rclone.org/. Also, testing filters with rclone lsf commands, and also with --dry-run added to your copy/sync command, can be useful. If you are familiar with regular expression syntax, --dump filters will give you valuable insight.

A filter device/*.jpg will match remote:/devices/flower.jpg as well as remote:/some/dir/devices/flower.jpg.

A filter /device/*.jpg will match remote:/devices/flower.jpg, but not remote:/some/dir/devices/flower.jpg.

So depending on what you want, your example could make perfect sense:

--exclude=device/*.jpg --exclude=device/*.png --exclude=device/*.log

With filtering there are often many ways to express the same thing, so one alternative is:

--include devices/*.{jpg,png,log}


a new sync with exclude would remove from remote the filtered files?

Not without option --delete-excluded. Use with care, test with --dry-run first.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.