Skip to content

Instantly share code, notes, and snippets.

@tjunghans
Last active July 27, 2017 13:54
Show Gist options
  • Save tjunghans/8260b4837533d4353c1dda1b2389ed31 to your computer and use it in GitHub Desktop.
Save tjunghans/8260b4837533d4353c1dda1b2389ed31 to your computer and use it in GitHub Desktop.
# Unix find documentation: https://kb.iu.edu/d/admm
# Remove all node_modules that were modified 60 days or earlier (to free up disc space)
find ./* -maxdepth 1 -path '*node_modules*' -type d -mtime +60 -exec rm -rf {} \;
# Show all directories containing node_modules that were modified 60 days or earlier
find ./* -maxdepth 1 -path '*node_modules*' -type d -mtime +60 -print
# Run this script where all the checked out projects are.
find . -maxdepth 2 -type d -ctime +60 -name node_modules | grep -vE "(node-deploy|node-release|stash-client|kibana-dashboards|package-manager)" | xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment