Skip to content

Instantly share code, notes, and snippets.

@batiste batiste/md5.py
Created Jun 22, 2019

Embed
What would you like to do?
Moi aussi
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pour executer ce script
# 1. Avoir python installé (déjà présent sur Mac ou Linux)
# 2. Ouvrir un Terminal (logiciel Terminal sur mac)
# 3. Taper dans le terminal: python <ce script> <le répértoire> > <fichier de sortie>
# E.g. python md5.py /Users/toto/Documents > output.txt
import glob
import hashlib
import sys
if len(sys.argv) < 2:
sys.stderr.write("Fournir le répértoire comme premier argument: e.g. python md5.py /Users/toto/Documents\n")
else:
filenames = glob.glob(sys.argv[1] + "/*.dpx")
for filename in filenames:
with open(filename, 'rb') as inputfile:
data = inputfile.read()
print(filename, hashlib.md5(data).hexdigest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.