Tema: atverciau visus kozirius :)
Autorius: Nerijus T
Data: 2015-02-01 15:33:52
from os import listdir
from os.path import isfile, join
import hashlib
import os.path

mypath1 = '/win1/app/upelis/upe-new-27/'
mypath2 = '/win1/app/upelis/upelis-new/'
onlyfiles1 = [ f for f in listdir(mypath1) if isfile(join(mypath1,f)) ]
onlyfiles2 = [ f for f in listdir(mypath2) if isfile(join(mypath2,f)) ]
for file1 in onlyfiles1:
	if os.path.exists(join(mypath1,file1)) and os.path.exists(join(mypath2,file1)) and isfile(join(mypath1,file1)) and isfile(join(mypath2,file1)):
		m1 = hashlib.md5()
		m2 = hashlib.md5()

		data1=''
		data2=''
		with open (join(mypath1,file1), "r") as myfile:
			data1=myfile.read()

		m1.update(data1)
		paras1=m1.hexdigest()
		with open (join(mypath2,file1), "r") as myfile:
			data2=myfile.read()

		m2.update(data2)
		paras2=m2.hexdigest()
		if not paras1 == paras2 :
			print file1.rstrip()+"\n"
print "none exist dir 2\n"
for file1 in onlyfiles1:
	if os.path.exists(join(mypath1,file1)) and not os.path.exists(join(mypath2,file1)):
		print file1+"\n"
print "none exist dir 1\n"
for file2 in onlyfiles2:
	if not os.path.exists(join(mypath1,file2)) and os.path.exists(join(mypath2,file2)):
		print file2+"\n"