Rename files by md5 checksum

08
2014-07
  • Rublacava

    What program can I use to rename files with their calculated md5 checksums? GUI or CLI Programs for Linux or Windows or scripts for DOS or the Linux terminal.

  • Answers
  • Matty

    This will work in Python if it is what you are looking for. It will take and calculate an md5 for a file and then rename the file that sum. Will work on *nix/Windows/?

    /usr/bin/env python
    
    import os, hashlib
    
    file = 'path/to/file'
    
    
    def main():
    
      h = hashlib.md5(file)
      output = h.hexdigest()
      os.rename( file, output)
    
    if __name__ == '__main__':
      main()      
    

  • Related Question

    software rec - File checksum calculator for Windows
  • Django Reinhardt

    I'm looking for a light, fast hash/checksum calculator (eg. MD5, SHA1, etc.). I've been using HashCalc and it works fine enough, but I was wondering if there was something better.

    When downloading .ISOs from MS BizSpark, I've found that it's essential to check the SHA1, and I'm sure that other people have found the same. So what's the defacto, light, fast, simple app that does the job?


  • Related Answers
  • Kailash Badu

    HashTab looks good.

  • 8088

    The HashCheck Shell Extension is similar to HashTab, but better (supports checksum files and multiple files at once), except the rare hash algorithms.

    • Shell integration: checksums at your fingertips (support multiple files and directories):

      enter image description here

      enter image description here

    • Checksum/hash verification: process and verify the checksums/hashes stored in checksum files (.sfv, .md4, .md5, or .sha1 file extension.):

      alt text

    • Create checksum files

      alt text

    • Lean and mean: very small memory and disk footprint (the 32-bit version consumes less than 100 KiB of disk space). It is also very fast and responsive; it can, for example, load and parse a SFV file with a million entries in just a fraction of a second.

    • Free and open-source

    • Compatibility: international support and 64-bit-compatible

  • 8088

    My choice:

    NirSoft's HashMyFiles is small utility that allows you to calculate the MD5 and SHA1 hashes of one or more files in your system. You can easily copy the MD5/SHA1 hashes list into the clipboard, or save them into text/html/xml file.

    alt text

    HashMyFiles can also be launched from the context menu of Windows Explorer, and display the MD5/SHA1 hashes of the selected file or folder.

    alt text

    I'm a great fan of NirSoft products, they're pure quality. You may want to check out NirLauncher: a handy launch GUI for all their system utilities. It doesn't stop there however - you can now include the entire Sysinterals Suite as well. All free and all portable ... a 'must have' for techie's toolbox. :)

    alt text

  • 8088

    "De Facto", you say? Well, there isn't really a standard one everyone uses, but some may remember the good old digestIT 2004. An excellent lightweight app for calculating and verifying MD5 and SHA-1 digests. It integrates into the Windows context menu so it is quickly accessible at any time:

    alt text

    For verifying a hash from a website, it's as easy as right click -> digestIT 2004 -> Verify (hash type)

    alt text

    alt text

  • Anders

    The command line tools md5sum and sha1sum that are available in Cygwin are very useful.