Extra Newby question - Trying to create md5 File Listing
Jim
jxjohns at lifeway.com
Thu Sep 28 09:40:57 EDT 2006
Gabriel and Dennis, than you for all your help. I ended up talking to
a friend a work about it and here's what we cam up with. It's very
similar to your suggestions so again, thanks. I just need to add a
machine name so I can get a md5 log from multiple machines and put it
in a database for version control monitoring.
Blessings, Jim.
#!/usr/bin/python
# Filename: md5makr.py
import sys
import os, os.path
import glob
import md5
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('md5makr.ini')
outputfilname = config.get('general', 'outputfile')
f = file(outputfilname,'wt')
fileconfig = config.get('general', 'inputfiles')
# print 'fileconfig is ', fileconfig
fl = file(fileconfig,'r')
pathlist = [fli.strip() for fli in fl.readlines()]
# print 'fileData is ', fileData # so far so good
for p in pathlist:
filelist = glob.glob(p)
for fn in filelist:
data = file(fn,'rb').read()
hexstring = md5.md5(data).hexdigest()
f.write(fn + '\t' + hexstring + '\n')
f.close()
More information about the Python-list
mailing list