Last active
September 6, 2024 17:42
-
-
Save derekmurawsky/71e596588320521f5145a152858239ef to your computer and use it in GitHub Desktop.
A simple cleanup script that looks for common local dependency caches below your current directory and deletes them
This file contains hidden or 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 | |
| find . -name '.yarn' -type d -prune -exec rm -rf '{}' + | |
| find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + | |
| # Note: There may be things to consider with deleting the .terraform directory. For me, this works | |
| # but think through it for you're use case. https://developer.hashicorp.com/terraform/cli/init#working-directory-contents | |
| find . -name '.terraform' -type d -prune -exec rm -rf '{}' + |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There has to be a cleaner way as this grows... At least this method only iterates through once.
find . \( -name '.yarn' -o -name 'node_modules' -o -name '.terraform' -o -name 'cdk.out' -o -name 'target' -o -name '.venv' -o -name 'dist' -o -name 'out' -o -name '.next' \) -type d -prune -exec rm -rf '{}' +