I’m trying to find all RCLONE_TEST files in the tree that are not beneath */RCloneSync/Test/.
The first command demonstrates that --exclude excludes all files from the directory, but when I then add the --include rclone is finding matches in the excluded directory. What is the correct way to do this?
Rclone maintains a combined list of include rules and exclude rules.
Each file is matched in order, starting from the top, against the rule in the list until it finds a match. The file is then included or excluded according to the rule type.
I read this as the exclude would be the first match for the files beneath the excluded directory.
$ rclone -v ls --include x --exclude x /tmp/test
2018/06/22 22:16:39 INFO : Using --filter is recommended instead of both --include and --exclude as the order they are parsed in is indeterminate
But I see the log level needs to be raised so it appears without -v so I’ve done that.
Thanks Nick,
Your recommendation is where I ended up.
Note that one cannot predictable use both --filter-from and --filter. With --dump filters I’m seeing that (something like) “+ /*” always ends up at the top of the directory filter list, effectively blocking the <- directories> on the command line.
Luckily, for my application, I don’t need the --filter-from filtered items while at the same time doing the command line. If both --filter-from and command line --filter should play nice together then shall I file a bug?
In any case, an update to the Filtering docs page would be quite helpful, noting not to use both command line --include and --exclude together. I think the current doc says it should work.
FYI, I dropped in 1.42 beta and rclonesync still works fine. I’m adding test case support and need to ignore possible RCLONE_TEST file mismatches in the test directories without tripping the access check fail. I’ll push an update to https://github.com/cjnaz/RCloneSync within a couple days.
If you just use one -filter and one --filter-from then things will be consistent, but if you use multiple then you run into the same problem of having multiple --include and --exclude statements.