cmd/crc32.py

12 lines
294 B
Python
Raw Normal View History

2020-05-13 01:17:17 +00:00
import sys
import zlib
from voussoirkit import winglob
patterns = sys.argv[1:]
files = [file for pattern in patterns for file in winglob.glob(pattern)]
for file in files:
with open(file, 'rb') as handle:
crc = zlib.crc32(handle.read())
print(hex(crc)[2:].rjust(8, '0'), file)