Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # It goes something like this: ls the packages, grep the names, make them
- # unique, find duplicates, sort by version, remove old versions.
- # See that gsort (macOS)? $ brew install coreutils
- ls `yarn cache dir` | grep -oE "^(npm-[a-z-]+)" | uniq | while read i; do ls -1d "$i"* | grep -E "$i\d" | wc -l | { read c; if (( $c > 1 )); then ls -1d "$i"* | grep -E "$i\d" | gsort -Vr | tail -n +2 | xargs rm -r; fi}; done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement