| |
---|
| | import sys |
---|
| | |
---|
| | # Version info |
---|
| | |
---|
| | VERSION = "$Id: tdir,v 1.65 2001/07/21 20:10:06 tundra Exp $" |
---|
| | VERSION = "$Id: tdir,v 1.66 2001/07/21 20:38:29 tundra Exp $" |
---|
| | |
---|
| | |
---|
| | # Booleans |
---|
| | |
---|
| |
---|
| | |
---|
| | def OrderByExtension(list): |
---|
| | ExtList = {} |
---|
| | ExtList[""] = [] # List of files with no extension |
---|
| | |
---|
| | for x in list: |
---|
| | y = x.rfind(SEP) |
---|
| | if y != -1: # File has extension |
---|
| | ext = x[y+1:] |
---|
| | if not y: # Handle special case of 'dot file' type files |
---|
| | ext = "" |
---|
| | name = x |
---|
| | elif y != -1: # File has extension |
---|
| | ext = x[y:] |
---|
| | name = x[:y] |
---|
| | if not ExtList.has_key(ext): |
---|
| | ExtList[ext]= [] |
---|
| | ExtList[ext].append(name) |
---|
| | else: # File has no extension |
---|
| | ExtList[""].append(x) |
---|
| | ext = "" |
---|
| | name = x |
---|
| | ExtList[ext].append(name) |
---|
| | |
---|
| | return ExtList |
---|
| | |
---|
| | |
---|
| | def OutputColumns(list, ISDIRLIST): |
---|
| |
---|
| | for x in Ext: |
---|
| | FileList = ExtList[x] |
---|
| | if len(FileList) > 0: |
---|
| | FileList.sort() |
---|
| | if x == "": |
---|
| | sep = x |
---|
| | else: |
---|
| | sep = SEP |
---|
| | sys.stdout.write("{" + sep + x + "}\n") |
---|
| | sys.stdout.write("(" + x + ")\n") |
---|
| | OutputColumns(FileList, FALSE) |
---|
| | |
---|
| | else: |
---|
| | FileList.sort() |
---|
| |
---|
| | |