blob: 7d860a912a164954917e74ec03300e6569f6ed06 [file] [log] [blame]
Just van Rossuma840fca1999-09-26 12:25:06 +00001import sys
2import os
3import macfs
4
5def walk(top):
6 names = os.listdir(top)
7 for name in names:
8 path = os.path.join(top, name)
9 if os.path.isdir(path):
10 walk(path)
11 else:
12 if path[-4:] in ['.pyc', '.pyo'] and os.path.exists(path[:-1]):
13 print "deleting:", path
14 os.remove(path)
15 elif path[-4:] == '.pyc':
16 print "!!! ------ .pyc file without .py file:", path
17 elif path[-4:] == '.pyo':
18 print "!!! ------ .pyo file without .py file:", path
19
20fss, ok = macfs.GetDirectory('Select the starting folder:')
21if ok:
22 walk(fss.as_pathname())