File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Zap .pyc files
1+ #!/usr/local/bin/python
2+ """Recursively zap all .pyc files"""
23import os
34import sys
45
6+ # set doit true to actually delete files
7+ # set doit false to just print what would be deleted
58doit = 1
69
710def main ():
8- if os . name == 'mac' :
9- import macfs
10- fss , ok = macfs . GetDirectory ( 'Directory to zap pyc files in' )
11- if not ok :
12- sys . exit ( 0 )
13- dir = fss . as_pathname ( )
14- zappyc ( dir )
15- else :
16- if not sys . argv [ 1 :] :
11+ if not sys . argv [ 1 :] :
12+ if os . name == 'mac' :
13+ import macfs
14+ fss , ok = macfs . GetDirectory ( 'Directory to zap pyc files in' )
15+ if not ok :
16+ sys . exit ( 0 )
17+ dir = fss . as_pathname ( )
18+ zappyc ( dir )
19+ else :
1720 print 'Usage: zappyc dir ...'
1821 sys .exit (1 )
19- for dir in sys .argv [1 :]:
20- zappyc (dir )
22+ for dir in sys .argv [1 :]:
23+ zappyc (dir )
2124
2225def zappyc (dir ):
2326 os .path .walk (dir , walker , None )
You can’t perform that action at this time.
0 commit comments