Created
April 19, 2017 22:55
-
-
Save garretttaco/04fef6b1d8cbfb1c3d2cc8ea41613573 to your computer and use it in GitHub Desktop.
Delete node_modules that have not been touched after 60 days.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
delete_nm() { | |
find $1 -type d -maxdepth 1 -mtime +60 | xargs -I $ find $ -type d -name node_modules -maxdepth 1 -exec echo rm -rf {} \; | |
read -p "Are you sure you wish to delete the node_modules folders above? " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
find ~/Projects -type d -maxdepth 1 -mtime +60 | xargs -I $ find $ -type d -name node_modules -maxdepth 1 -exec rm -rf {} \; | |
echo "Finished delete" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment