"+" include part doesn't work in the "--filter-from file"

What is the problem you are having with rclone?

I use RClone to list the specific files, but when I use --filter-from parameters, I found the include (+) function did not work.

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

[root@node51 share]# rclone version
rclone v1.68.1
- os/version: centos 9 (64 bit)
- os/kernel: 5.14.0-480.el9.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.1
- go/linking: static
- go/tags: none

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

The Linux local storage.

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

My files in the directory are below:

[root@node51 share]# rclone --config="${SFM_HOME}/conf/rclone.conf" lsl /public/exports/share/ --local-time-type mtime --max-age 24h --max-depth 1 --max-size 4K
       47 2024-09-29 16:15:41.312499555 .rmtab
     1024 2024-09-29 14:59:31.600873047 1KB-File
     2048 2024-09-29 14:59:40.116323284 2KB-File
     4096 2024-09-29 14:59:45.871303395 4KB-File
       14 2024-09-29 15:58:29.949098949 filter.txt
        9 2024-09-29 11:33:05.357951422 zxczxc.txt

My filter file is:

[root@node51 share]# cat filter.txt
- *4*
+ *File

When I run this command:

rclone --config="${SFM_HOME}/conf/rclone.conf" lsl  --filter-from filter.txt /public/exports/share/ --local-time-type mtime --max-age 24h --max-depth 1 --max-size 4K -vv 

The results contain .rmtab, zxczxc.txt files. I think the result should be only 1KB-File and 2KB-File

       47 2024-09-29 16:19:42.637894571 .rmtab
     1024 2024-09-29 14:59:31.600873047 1KB-File
     2048 2024-09-29 14:59:40.116323284 2KB-File
       14 2024-09-29 15:58:29.949098949 filter.txt
        9 2024-09-29 11:33:05.357951422 zxczxc.txt

It seems that in the filter.txt file, - (exclude part) is effective, but + (include part) is not. But I can manually add "--include "KB"" in the command line and it works. I don't know where I went wrong. Please tell me the reason, thank you very much.

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

 rclone --config="${SFM_HOME}/conf/rclone.conf" lsl  --filter-from filter.txt /public/exports/share/ --local-time-type mtime --max-age 24h --max-depth 1 --max-size 4K -vv
2024/09/29 16:19:49 DEBUG : rclone: Version "v1.68.1" starting with parameters ["rclone" "--config=/opt/smartfiles-1.2/conf/rclone.conf" "lsl" "--filter-from" "filter.txt" "/public/exports/share/" "--local-time-type" "mtime" "--max-age" "24h" "--max-depth" "1" "--max-size" "4K" "-vv"]
2024/09/29 16:19:49 DEBUG : Creating backend with remote "/public/exports/share/"
2024/09/29 16:19:49 DEBUG : Using config file from "/opt/smartfiles-1.2/conf/rclone.conf"
2024/09/29 16:19:49 DEBUG : fs cache: renaming cache item "/public/exports/share/" to be canonical "/public/exports/share"
2024/09/29 16:19:49 DEBUG : 123.txt: Excluded (ModTime Filter)
2024/09/29 16:19:49 DEBUG : 123.txt: Excluded
       47 2024-09-29 16:19:42.637894571 .rmtab
     1024 2024-09-29 14:59:31.600873047 1KB-File
     2048 2024-09-29 14:59:40.116323284 2KB-File
       14 2024-09-29 15:58:29.949098949 filter.txt
        9 2024-09-29 11:33:05.357951422 zxczxc.txt
2024/09/29 16:19:49 DEBUG : 4 go routines active

Can be just this? As per docs:

--filter + differs from --include. In the case of --include rclone implies an --exclude * rule which it adds to the bottom of the internal rule list. --filter...+ does not imply that rule.

So maybe try:

- *4*
+ *File
- *

It works.
Thank you very much.
^o^

1 Like

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