-
Notifications
You must be signed in to change notification settings - Fork 0
/
pcu.py
28 lines (22 loc) · 909 Bytes
/
pcu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python
# pcu : Path Clean Up, a script to gener8 .bat file commands to delete .pdb files
# and other unnecessary space hogs from throughout the subfolders of a given path
import os
from os.path import join
import sys
import time
def generate_del_commands( path ) :
count = 0
rejects = ['old', 'orig', 'obj', 'sbr', 'pch', 'exe', 'dll', 'ilk', 'pdb', 'scc', 'idb', 'exp', 'lib', 'bsc', 'plg', 'res', 'opt', 'rig', 'log', 'ncb', 'aps', 'clw']
for root, dirs, files in os.walk(path) :
for name in files :
ext = name[-3:]
if (ext in rejects):
print( 'del "', join(root, name) )
count += 1
print( 'rem ', count, ' deleted.' )
if __name__ == "__main__" :
if len( sys.argv ) > 1:
generate_del_commands( sys.argv[1] )
else :
print( 'usage: python ' + sys.argv[0] + ' from_path' )