Skip to content

Instantly share code, notes, and snippets.

@demiurg
Last active August 29, 2015 13:58
Show Gist options
  • Save demiurg/10411212 to your computer and use it in GitHub Desktop.
Save demiurg/10411212 to your computer and use it in GitHub Desktop.
import os
from os.path import *
import shutil
brewdirs = set()
for r, d, files in os.walk('/usr/local/lib'):
for n in files:
f = join(r,n)
if islink(f) and "/Cellar/" in realpath(f):
dirs = f.split('/')
brewdirs.add("/".join(dirs[:5]))
for path in brewdirs:
shutil.rmtree(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment