Add md5it.py

This commit is contained in:
TKE
2020-05-17 10:30:17 +02:00
parent 703db4a708
commit ca1a7db15e

13
md5it.py Normal file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import os
import hashlib
BLOCKSIZE=65536
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
md5=hashlib.md5()
with open(f,'rb') as fd:
fb=fd.read(BLOCKSIZE)
while len(fb)>0:
md5.update(fb)
fb=fd.read(BLOCKSIZE)
os.rename(f,md5.hexdigest())