[Tutor] trying to get md5sums of a list of files

John Moylan john@rte.ie
Thu Jul 17 10:04:02 2003


Hi,

I have a list of the 1.5million filename with paths, on my NAS. 
I am going to compute md5sums for each file and sort them; check for duplicate files.
This is relatively easy in bash:
for i in `cat filelist` do; md5sum $i; done

However, as an educational exercise, I want to do this in Python.

So I coded up the following:

#!/usr/local/bin/python

import os, sys, md5

for path in open('filelist2'):
        myline = path.strip()
        f = open(myline, 'r')
        m = md5.new()
        for line in f.readlines():
                m.update(line)
        f.close()
        md5sum = m.digest()
        print m

However, the output does not make sense, where have I gone wrong?

Thanks in Advance,
John 


******************************************************************************
The information in this e-mail is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this e-mail by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
Please note that emails to, from and within RTÉ may be subject to the Freedom
of Information Act 1997 and may be liable to disclosure.
******************************************************************************