Reputation: 9905
I'm doing a HDD upgrade, and while trying to backup my NodeJS projects i realize that all node_modules
subfolders have over 1 milion files.
So i'm looking for a way to remove all the node_modules
subfolders and all their contents.
The projects are located in :
C:/Node/App1/node_modules/..
C:/Node/App2/node_modules/..
C:/Node/App3/node_modules/..
etc..
My OS is Windows 10, but i can try either Windows or Linux commands because i'm using cmder, and it accepts both types of commands.
Upvotes: 1
Views: 3285
Reputation: 9905
I tested this command in various situations and it seems to work fine.
for /d /r . %d in (node_modules) do @if exist "%d" rd /s/q "%d"
I'm not sure how it works, it's an adapted solution from Here, if you need more details.
Upvotes: 6
Reputation: 3461
For Linux:
cd Node
find . -maxdepth 2 -name node_modules -type d -exec rm -rf {} +
Upvotes: 7