Extra Newby question - Trying to create md5 File Listing

Jim jxjohns at lifeway.com
Wed Sep 27 22:13:55 CEST 2006


Thanks Dennis, I'm feeling very stupid.  You're right about the config
file containing drive/path/filenames (eg. c:\python24\*.exe or
whatever).  I want to output a text file that contains records like
c:\python24\pythonw.exe[tab]md5 value, ... next file record.  The
following snippet works but I don't know how to loop through using the
config value to get e glob for each file.  I'll keep working at it.

filelist = glob.glob('c:\\python24\\*.exe')

# print 'filelist is', filelist

for fn in filelist:
  data = file(fn,'rb').read()
  hexstring = md5.md5(data).hexdigest()
  f.write(fn + '\t' + hexstring + '\n')

f.close()

Thanks.




More information about the Python-list mailing list