Skip to content

Instantly share code, notes, and snippets.

@batiste
Created June 22, 2019 11:12
Show Gist options
  • Save batiste/4f6a5aa4dc92cbea677e9ea7298c8ffd to your computer and use it in GitHub Desktop.
Save batiste/4f6a5aa4dc92cbea677e9ea7298c8ffd to your computer and use it in GitHub Desktop.
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