Hello,

I'm trying to gather a list of files and md5 hash them to do a checksum.
I've created a function for each dictionary. However, when i print out
the dictionary I don't get all the items. Any ideas?

Thanks<
JJ

CODE:

#!/usr/bin/python
import os
import md5
import sys

source={}
target={}

source_path="/path/source"
target_path="/path/target"

def gather_files(dir,dict):
        os.chdir(dir)
        names=os.listdir(dir)
        for filename in names:
                hash=os.system("md5 "+ filename)
                dict[hash] = filename
        print dict

gather_files(source_path,source)
gather_files(target_path,target)


OUTPUT:

# python new.py 
b481bb58b296a62d744d3006d0156f61 1
e07910a06a086c83ba41827aa00b26ed 3
749a92a5ba327db2f2711b1a8d3cc0ab 2
{0: '2'}
b481bb58b296a62d744d3006d0156f61 1
e6139f93eb47c9fe7eb7fc5ddb586511 3
7ce1a3a4baf75dea4397e36c97e1fc0b 2
{0: '2'}



Disclaimer: The information contained in this transmission, including any 
attachments, may contain confidential information of Panasonic Avionics
Corporation.  This transmission is intended only for the use of the 
addressee(s) listed above.  Unauthorized review, dissemination or other use 
of the information contained in this transmission is strictly prohibited. 
If you have received this transmission in error or have reason to believe 
you are not authorized to receive it, please notify the sender by return 
email and promptly delete the transmission.


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to