Delete all node_modules folders recursively on Windows 10
March 26, 2020
First of all:
- Make sure your current directory is where most of your projects are. For example: projects/angular or projects/gatsby .
- Use caution, this process is irreversible!
- These scripts are tested on Windows 10 with cmder.
Run this to see which folders will be deleted:
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
And then to actually delete them, just run this:
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"