Created
February 28, 2010 03:03
-
-
Save dekz/317138 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import os | |
import sys | |
import shutil | |
size = 0 | |
def grem(path, list): | |
global size | |
for file in os.listdir(path): | |
if os.path.isdir(os.path.join(path, file)): | |
if (file.find("sample") >= 0) or (file.find("Sample") >= 0): | |
removeme = os.path.join(path, file) | |
print "RMDIR: " + removeme | |
shutil.rmtree(removeme) | |
break | |
print "MOV: " + file | |
grem(os.path.join(path, file), removelist) | |
for listitem in list: | |
if file.find(listitem) >= 0: | |
try: | |
removeme = os.path.join(path, file) | |
print "RMV: " + removeme + " SIZE: " + str((os.path.getsize(removeme))) | |
size += os.path.getsize(removeme) | |
os.remove(removeme) | |
except: | |
print "Failed in " + path | |
removelist = [u".sfv", u".nzb", u"sample", u".nfo", u".txt", 'Thumbs.db', u"Sample"] | |
grem(u'/Volumes/morbo/Downloads/complete/', removelist) | |
print size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment