newbeen Posted May 4, 2008 at 12:47 AM Report Share #183267 Posted May 4, 2008 at 12:47 AM Deixem aí ajudas para métodos melhorias vou precisar disto para um projecto meu em desenvolvimento..... import os, md5, tkFileDialog ####################################### #### GetMd5 by Newbeen beta relase ### #### ----------------------------- ### #### | ToDo: comparar md5 de 2 | ### #### | ficheiros, corregir bug | ### #### | quando um ficheiro esta | ### #### | em uso pára execucao... | ### #### |____________________________| ### ####################################### class GetMd5: def listfiles(self, arg, dirname, names): flist=open("listfile.txt", "a") for name in names: afile=os.path.join(dirname, name) if os.path.isfile(afile): hashmd5=file(afile ,'rb') md5_file=md5.new(hashmd5.read()).digest().encode('hex') flist.write(afile+'\t'+md5_file+'\n') print afile+"\t is file md5 --> "+md5_file else: flist.write(afile+'\n') print afile+"\t directiry" print "\n" flist.close() md=GetMd5() dire=tkFileDialog.askdirectory()#corrigir bug fazer desaparecer janela!!! os.path.walk(dire, md.listfiles, None) raw_input('Prima Qualquer tecla para sair resultado no listfile.txt') Abraços! RHCE - 120-062-534 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now