How to exclude all directories of a file pattern

Hi,

My directory structure is something like:
projectRoot

project1 > node_modules > ...
project2 > ... > node_modules > ...
...

I want to exclude all directories matching the pattern node_modules in any sub-directory. I have tried running the following:

rclone.exe --filter-from C:\Users\user_x\filter.txt --delete-excluded C:\Users\user_x\ DESTINATION:\\destinationFolder -v --dry-run

with the following filter.txt

## Includes
+ projectRoot/**

## Exclude node modules (doesn't work)
- *node_modules/**

## Exclude everything else
- *

I have also tried - */node_modules/**, - *node_modules/**, -*node_modules/*, -*node_modules/. However, all of the dry-run's show that the node_modules folders are not excluded..

I have also tried to execute without the dry-run, but the execution failed with errors. E.g.

ERROR : projectRoot/testAngular/angularTourOfHeroes/node_modules/istanbul-api/node_modules/.bin/semver: Failed to copy: failed to open source object: The file cannot be accessed by the system.
ERROR : projectRoot/testAngular/djangoAngProj/frontend/flight-scheduler/node_modules/copy-webpack-plugin/node_modules/.bin/json5: Failed to copy: failed to open source object: The file cannot be accessed by the system.

Appreciate some help in shedding light on the correct syntax please. Thanks!

It's an order of operations thing.

You want your excludes before your includes. The first line includes it and you try to exclude it later, which it already has been included by your first rule.

So make the exclude first and than the include.

Best way to try is to just do a rclone ls command on your path and test it out.

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