From ca1a7db15e1cdaa941711a3b3aa973f4c0529ee8 Mon Sep 17 00:00:00 2001 From: TKE Date: Sun, 17 May 2020 10:30:17 +0200 Subject: [PATCH] Add md5it.py --- md5it.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 md5it.py diff --git a/md5it.py b/md5it.py new file mode 100644 index 0000000..d7093d5 --- /dev/null +++ b/md5it.py @@ -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())