Skip to content

Instantly share code, notes, and snippets.

@simondch
Created February 18, 2021 16:25
Show Gist options
  • Save simondch/dcd840a99146800e1be1ce315e240d89 to your computer and use it in GitHub Desktop.
Save simondch/dcd840a99146800e1be1ce315e240d89 to your computer and use it in GitHub Desktop.
delete node_modules recursively

Linux / Mac OS

List

find . -name "node_modules" -type d -prune | xargs du -chs

Delete

find . -name "node_modules" -type d -prune -exec rm -rf '{}' +

Windows

List

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

Delete

FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment