A way to test the filter?

Hi, I would appreciate a way to test specific file against the rclone filter. I.E. I would like to execute a command similar to this:

rclone filtertest local_path --filter-from="filter1.txt" --fiter-from="filter2.txt"

and have an answer that would indicate whether the file would be processed or excluded by the filters if passed with these filters to a copy command.

I know there is --dry-run, but it connects to the server and that takes time. I need to test many files in a short time.

I need this, because I am trying to make myself an instant-sync feature with rclone, where files are backed up a short while after they have been modified. I already have the file modification detection, but that doesn't know about rclone filters. I then contruct a filter that contains only the files that need to be synced. I would like to avoid calling rclone if all the files to sync would be excluded by rclone.

Now I would have to write a procedure that mimics the rclone filter, but that would be a very difficult task.

Just make a local directory based on your file and run against that.

I use that all the time to test filters.

1 Like

This works very well! Thank you.
Instead of creating a directory I used remote of type memory, and --dry-run, so the files are not going anywhere.
And with --stats=0 the only output are the files that would be included by the filters.

That's exactly what I need.

1 Like

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