Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. # It goes something like this: ls the packages, grep the names, make them
  2. # unique, find duplicates, sort by version, remove old versions.
  3.  
  4. # See that gsort (macOS)? $ brew install coreutils
  5. 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