Size: 610
Comment:
|
Size: 600
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 22: | Line 22: |
fileList.sort() fileList.reverse() |
fileList.sort() fileList.reverse() |
1 #!/usr/bin/env python
2 import os,fnmatch,sys
3
4 # Usage:
5 # ./walkdir.py directory extension
6
7 dir,ext=sys.argv[1],sys.argv[2]
8 fileList=[]
9 for root, dirs, files in os.walk(dir):
10 f=fnmatch.filter(files,'*.'+ext)
11 if type(f)==type([]):
12 for fi in f:
13 fName=root+os.path.sep+fi
14 fSize=os.path.getsize(fName)
15 fileList.append([fSize,fName])
16 fileList.sort()
17 fileList.reverse()