I have many dist folders inside src folder. It can be nested at any depth.
src
- dist
- main
- dist
- com
- dist
....
- test
- dist
- com
- dist
I need a command in rimraf to delete all such dist folders inside src folder.
I tried rimraf src/**/dist, src/*/dist, src/**/*/dist, but none of them are working, in fact I am getting an error saying Error: Illegal characters in path.
If its not possible to do this with rimraf, is there any other simpler solution using node js? The tedious solution might be to write my own script to call rimraf recursively after I get directory structure using fs or something.
You should be able to use the
--globflag:Use case
Here is a basic
init.jsfile to get the folder structure set up:And here is the
clean.js: