Skip to content

Instantly share code, notes, and snippets.

@anhtuank7c
Created January 7, 2023 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anhtuank7c/07087aa6470e910a6c7d9a58abf6c308 to your computer and use it in GitHub Desktop.
Save anhtuank7c/07087aa6470e910a6c7d9a58abf6c308 to your computer and use it in GitHub Desktop.
[Mac/Linux] List and remove all the node_modules at the current directory
#!/bin/bash
# Cleanup node_modules
echo "Calculate disk space for node_modules in all directory"
find . -name "node_modules" -type d -prune -print | xargs du -chs
echo "Remove all node_modules directory"
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment