Rclone Copy - certain filter flags ignored

What is the problem you are having with rclone?

When I run rclone copy with the --filter-from flag only part of the filters get applied. I have recreated the problem with arbitrary folder names below. I spent some time on the forum and read multiple articles on this or related topics but have not managed to resolve my issue.
When I run the command given below the respective folder4 gets created on the network share even though explicitly excluded.
When I run rclone copy ~/folder1 gdrive:folder2/folder3 --exclude folder4/ --dry-run the folder folder4 is ignored. To me this indicates, that I can run commands against folder4.

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

rclone v1.66.0
- os/version: arch rolling (64 bit)
- os/kernel: 6.6.22-1-lts (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.22.1
- go/linking: dynamic
- go/tags: none

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 copy ~/folder1 gdrive:folder2/folder3 --filter-from ~/filter.txt --dry-run

Contents of ~/filter.txt

+ *.pdf
+ folder5/**
- folder4/**
- **

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

type = drive
scope = drive
token = XXX
team_drive =

A log from the command that you were trying to run with the -vv flag

2024/03/29 16:03:11 DEBUG : Creating backend with remote "/home/xx/folder1"
2024/03/29 16:03:11 DEBUG : Using config file from "/home/xx/.config/xx/rclone.conf"
2024/03/29 16:03:11 DEBUG : Creating backend with remote "gdrive:folder2/folder3"
2024/03/29 16:03:12 DEBUG : Google drive root 'folder2/folder3': 'root_folder_id = yyy' - save this in the config to speed up startup
2024/03/29 16:03:12 NOTICE: folder4: Skipped make directory as --dry-run is set

Thanks for help on this

rules from --filter-from are processed in the order they are defined.

So if e.g. + folder5/** matches any element then - folder4/** is not even tested.

It means that you have to pay attention to rules order. I guess in your case you want:

- folder4/**
+ *.pdf
+ folder5/**
- *

Works like a charm. I get the feeling that this information is something, I should have stumbled across. Sorry for bothering you with this.

1 Like

No worries - it is documented in filtering docs but I have to admit I only learnt it hard way too:)

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