Guest User

Untitled

a guest
Jun 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. mport os
  2. import hashlib
  3.  
  4. def filerunk(file_path):
  5. for dirname, dirs, files in os.walk(file_path):
  6. for filename in files:
  7. full = os.path.join(dirname, filename)
  8. if not os.path.isfile(full):
  9. continue
  10.  
  11. hash = hashlib.sha1()
  12. f = file(full, "rb")
  13. while 1:
  14. bytes = f.read(1000000)
  15. if not bytes:
  16. break
  17. hash.update(bytes)
  18. print full, hash.hexdigest()
  19.  
  20. if __name__ == "__main__":
  21. filerunk("/tmp")
Add Comment
Please, Sign In to add comment