[Solved] Help with filter_rules

Hi, I’m having a difficult time getting a filter rule to work.

I’m trying to target temporary word files, they look like this

~$part_of_filename.doc

I’ve tried unsuccessfully:
- ~$*
- /~$*

(btw. it could be an idea to collaborate on a help/man page with all the different temporary files one would like to avoid with the matching filter rules)

Hey nle,

Your first syntax ~$* looks right for ignoring all files that start with ~$ in all directories.
My guess is it’s not working because the shell you’re using is trying to expand $…, * or ~.

Try putting that filter in either a filter-file or single quotes ( e.g. '~$*' ).

Single quotes are almost always a good idea when specifying filters in rclone. Also make sure you’re not using --exclude or --include as well, as AFAIK they are incompatible with --exclude. ( You should be able to replicate the same functionality with either –filter-from, or multiple –filter commands.

Good luck, keep us posted,
jedi453

1 Like

Thanks, but it does not work. I use --filter-from on a file with filter rules.

I tested with - '~$*'in the file, but no go. I did test just to be sure - *.doc and that worked, so the order of the filters, etc. should be okay.

I think you need to escape it with a \

- \~$*

or even:

- \~\$*

1 Like

Hmm, that works for me

$ rclone ls .
        6 filter_from.txt
        0 ~$temp_file
$ cat filter_from.txt 
- ~$*
$ rclone ls --filter-from filter_from.txt .
        6 filter_from.txt
$

Can you make an example like that showing the problem? Or post your full filters-from file?

1 Like

Thanks. Now it worked! :slight_smile:

The only difference since then is that I updated rclone from 1.40 to 1.41, but I can’t imagine that had anything to do with it.

I tried to replicate the behavior I saw yesterday, but no go. So I guess I must have made a stupid mistake.

Thanks to both of you @jedi453 and @ncw (and @TowerBR)

1 Like