j6ndev
9/26/2019 - 11:38 PM

Node modules

List all node_modules in a directory.

Linux:

$ cd documents
$ find . -name "node_modules" -type d -prune -print | xargs du -chs

Windows:

$ cd documents
$ FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"

Delete all node_modules in a directory.

Linux:

$ cd documents
$ find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;

Windows:

$ cd documents
$ FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"