Skip to content

Instantly share code, notes, and snippets.

@inigomarquinez
Created September 13, 2022 16:39
Show Gist options
  • Save inigomarquinez/acb5a78c8349cd08f98e8d5624525399 to your computer and use it in GitHub Desktop.
Save inigomarquinez/acb5a78c8349cd08f98e8d5624525399 to your computer and use it in GitHub Desktop.
Remove node_modules folders recursively
#! /bin/bash
CWD=$(pwd)
echo -e "Are you sure you want to remove all your node_modules folders recursively from here? (Press CTRL+C to cancel)"
echo -e "Current location: \e[32m$CWD\e[39m"
echo -n "Only 'yes' will be accepted to continue: "
read NEW_VALUE
if [ "$NEW_VALUE" = "yes" ]; then
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
else
echo -e "Canceled!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment