Rclone exclude not working for multiple rules

What is the problem you are having with rclone?

Using one --exclude flag works but multiple --exclude flags will ignore all of them!

I'm not sure why bc I've seen the same syntax suggested here: Rclone exclude multiple folders under windows - #2 by ncw

Run the command 'rclone version' and share the full output of the command.

rclone v1.60.1
- os/version: darwin 13.1 (64 bit)
- os/kernel: 22.2.0 (arm64)
- os/type: darwin
- os/arch: arm64
- go/version: go1.19.3
- go/linking: dynamic
- go/tags: none

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

NOTE: this is inside a .sh file

# rclone sync script
rclone sync "REDACTED" "REDACTED" \
--exclude "node_modules/**",  \
--exclude "**/.DS_Store",  \
--exclude "**/.angular/**",  \
--exclude-if-present ".rclone-ignore" \
--log-file "REDACTED"  \
--fast-list \
--verbose \
--progress

Hi sevshelby,

You seem to have a mistaken comma in the end of the first three exclude flags, so you only exclude files ending with comma. I therefore suggest you try removing the 3 commas.

Thanks, I noticed that too and removing it does not solve the problem. The forum doesn't allow me to update the original post to correct it

OK, sounds like we should stop guessing and take the systematic approach.

I therefore suggest you start by testing the individual filter patterns using rclone ls and individual include rules like this:

rclone ls yourSourceRemote:some/folder --include "node_modules/**"
rclone ls yourSourceRemote:some/folder --include "**/.DS_Store"
rclone ls yourSourceRemote:some/folder --include "**/.angular/**"

This makes it is relatively easy to see if each of the filter patterns match (some of) the expected files.

Next you can check, that each of them exclude (all of) the expected files, like this:

rclone ls yourSourceRemote:some/folder --exclude "node_modules/**"
rclone ls yourSourceRemote:some/folder --exclude "**/.DS_Store"
rclone ls yourSourceRemote:some/folder --exclude "**/.angular/**"
rclone ls yourSourceRemote:some/folder --exclude-if-present ".rclone-ignore"

and finally combine to a single command (in one or more steps):

rclone ls yourSourceRemote:some/folder --exclude "node_modules/**"  --exclude "**/.DS_Store" ...

I guess it will reveal a mistake in one or more of your filters, or at least help us to narrow down your issue.

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