Filter directories excluding those containing a certain string

Hello guys,
Is it possible to filter directories excluding those containing a certain string?
Example: \ home \ images
\ home \ docs \ comments1 \ sec
\ home \ docs \ tests \ comments2 \ sec

I want to make backups of the “home” folder, but excluding any path that contains the word “tests”

If this possibility already exists, can you give an example?


Sure, --exclude "**tests**" should do it - that will exclude any file or directory with the word “tests” in.

If you only want directories included then --exclude "*tests*/**"

You can use it in “–filter-from”

- * .dmp
- * .hdmp
- * tests * / **

or just with --exclude
If it is not possible, can I use it together? --exclude and --filter-from?


Yes you can put it in a filter-from file too. That is the best way - don’t use --exclude and --filter-from together.


- *.dmp
- *.hdmp
- *tests*/**

Great! I’ve performed several tests, the “-filter-from” is extremely versatile, files, folders, paths, all in one place … Thank you very much, the rclone is great! I need to study all the possible commands, I use only the basics yet, but I see that there dozens additional commands …
Congratulations on the great work!

1 Like