mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-28 14:12:52 -06:00
33 lines
740 B
Python
33 lines
740 B
Python
|
#!/usr/bin/env python2
|
||
|
# Cleanse the "../" directory of the following:
|
||
|
# - all files with a .pyc extension.
|
||
|
# - all "trash files" listed below:
|
||
|
# . parsetab.py - generated by the PLY module.
|
||
|
|
||
|
import os
|
||
|
|
||
|
|
||
|
extensions = ('.pyc',)
|
||
|
trashFiles = ('parsetab.py',)
|
||
|
|
||
|
print 'Changing to root directory...'
|
||
|
os.chdir('../')
|
||
|
|
||
|
print 'Scanning for garbage files...'
|
||
|
|
||
|
|
||
|
def delete(filepath):
|
||
|
print "Removing '%s'..." % filepath
|
||
|
os.unlink(filepath)
|
||
|
|
||
|
|
||
|
for root, folders, files in os.walk('.'):
|
||
|
for filename in files:
|
||
|
filepath = os.path.join(root, filename)
|
||
|
if os.path.splitext(filename)[1] in extensions:
|
||
|
delete(filepath)
|
||
|
elif filename in trashFiles:
|
||
|
delete(filepath)
|
||
|
|
||
|
print 'Done.'
|