Skip to content

Instantly share code, notes, and snippets.

@Pelirrojo
Forked from beeva-manueldepaz/killAllNodeModules.sh
Last active August 20, 2017 19:22
Show Gist options
  • Save Pelirrojo/c880be25332fad0951e55a9ecfc77540 to your computer and use it in GitHub Desktop.
Save Pelirrojo/c880be25332fad0951e55a9ecfc77540 to your computer and use it in GitHub Desktop.
Script to clean all npm & bower current instalations in a folder recursively
#!/bin/sh
# https://coderwall.com/p/guqrca/remove-all-node_module-folders-recursively
# $sudo mv /path/to/killAllNodeModules.sh /usr/local/bin/killAllNodeModules
# $sudo chmod a+x /usr/local/bin/killAllNodeModules
read -p "This will delete all node_modules & bower_componets in current and derived folders. Are you sure that you want to continue? (y/n) " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
find . -name "node_modules" -exec rm -rf '{}' +
find . -name "bower_components" -exec rm -rf '{}' +
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment