blob: f5213d072ef3334358fddc3a9011aa5872dab260 [file] [log] [blame]
Jack Jansen22586991996-02-21 15:27:24 +00001#
2# FixCreator - Search for files with PYTH creator
3# and set it to Pyth.
4#
5import os
6import macfs
7import sys
8
9OLD='PYTH'
10NEW='Pyth'
11
12def walktree(name, change):
13 if os.path.isfile(name):
14 fs = macfs.FSSpec(name)
15 cur_cr, cur_tp = fs.GetCreatorType()
16 if cur_cr == OLD:
17 fs.SetCreatorType(NEW, cur_tp)
18 print 'Fixed ', name
19 elif os.path.isdir(name):
20 print '->', name
21 files = os.listdir(name)
22 for f in files:
23 walktree(os.path.join(name, f), change)
24
25def run(change):
26 fss, ok = macfs.GetDirectory('Folder to search:')
27 if not ok:
28 sys.exit(0)
29 walktree(fss.as_pathname(), change)
30
31if __name__ == '__main__':
32 run(1)
33
34