Skip to main content

Compute a single hash of the file contents of a directory.

Project description

PyPI - Downloads badge2

A simple module for creating a single hash for a directory of files, with file contents; ignoring any metadata such as file name. Options exist to also exclude specific files or files with specific extensions.


from checksumdir import dirhash

directory  = '/path/to/directory/'
md5hash    = dirhash(directory, 'md5')
sha1hash   = dirhash(directory, 'sha1', excluded_files=['package.json'])
sha256hash = dirhash(directory, 'sha256', excluded_extensions=['pyc'])

Or to use the CLI:

# Defaults to md5.
$ checksumdir /path/to/directory

# Create sha1 hash:
$ checksumdir -a sha1 /path/to/directory

# Exclude files:
$ checksumdir -e <files> /path/to/directory

# Exclude files with specific extensions:
$ checksumdir -x <extensions> /path/to/directory

# Follow soft links:
$ checksumdir --follow-links /path/to/directory

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for checksumdir, version 1.2.0
Filename, size File type Python version Upload date Hashes
Filename, size checksumdir-1.2.0-py3-none-any.whl (5.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size checksumdir-1.2.0.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page