Skip to content

Instantly share code, notes, and snippets.

@serg-kovalev
Last active December 29, 2022 10:03
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 serg-kovalev/11ff4e01d8b384711ec449eb947c2cae to your computer and use it in GitHub Desktop.
Save serg-kovalev/11ff4e01d8b384711ec449eb947c2cae to your computer and use it in GitHub Desktop.
Remove all node_module folders in target folder
#!/bin/bash
set -ueo pipefail
usage_example="USAGE:\n\tExample: ./remove_node_modules ~/your-dev-folder"
if [ $# -lt 1 ]
then
echo -e $usage_example
exit 1
fi
folder=$1
shift 1
find $folder -type d -name "node_modules" -print0 | while read -d $'\0' $finding
do
rm -r $finding
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment