abgeschrieben von Gruppe 1 - klappt aber leider nicht!

   1 #!/usr/bin/env python
   2 import os,fnmatch,sys
   3 
   4 dir,ext= 'pf/u/u241127/', '.*'
   5 
   6 fileList=[]
   7 for root, dirs, files in os.walk(dir):
   8     f=fnmatch.filter(files,'*.'+ext)
   9     if type(f)==type([]):
  10         for fi in f:
  11             fName=root+os.path.sep+fi
  12             fSize=os.path.getsize(fName)
  13             fileList.append([fSize,fName])
  14 fileList.sort()
  15 fileList.reverse()
  16 
  17 print fileList

LehreWiki: Python/Exercise3/Group2 (last edited 2008-11-24 09:54:06 by AnjaRoesel)