cowwoc
(Gili)
December 23, 2017, 10:28am
1
Hi,
I am trying to include “config.xml” in all directories, exclude for the “backups” root-level directory. I tried invoking:
rclone sync --dump-filters --filter “- backups/**” --filter “+ config.xml” source target
and got the following output:
— start filters —
— File filter rules —
(^|/)config.xml$
— Directory filter rules —
The problem is that this is including non-config.xml files in the root directory. I think “+ ^.*$” is at fault. How do I filter that out?
Thanks,
Gili
cowwoc
(Gili)
December 23, 2017, 11:12am
2
I figured it out.
According to https://rclone.org/filtering/#how-the-rules-are-used each filter is matched in order, from top to bottom, against the list of filters. So I had to moved the exclusion filters around to get the desired behavior:
–filter “- backups/**” --filter “+ **/config.xml” --filter “- *”
That is, I always exclude “backups” even if they contain “config.xml”. I then exclude all non-config.xml files (at the end of the filter list).
Gili
ncw
(Nick Craig-Wood)
December 23, 2017, 5:08pm
3
Glad you figured it out. Note that you don't need the **/
prefix on the config.xml
as that is the default - do search everwhere for it.