Media Integrity

I have a very large collection of music that I keep meticulously sorted and tagged. I back it up nightly to an external drive, but that only insures that I have an emergency copy, not that files didn’t get corrupted or deleted. The obvious solution to that is to create par files for each CD so that corruption or accidentally changed files can be easily fixed. This would be a huge pain to do manually since I have over 1000 directories of music. I created this python script so I could create, verify, and repair all of the par files at once.


There are a few things you need before you can run this script.

  • Python 2.4 or greater – It may work with lesser versions, but I haven’t tested it.
  • WConIO – This is a windows console library for python that allows the script to output color.
  • Par2cmdline – the par2 program that will be doing the actual work. You will need to change the line in file to point to par2.exe.


Here are some examples of how to use the script.

This will create par2 files in every subdirectory of C:\Music that has files in it. -crd C:\\Music
This will check all the subdirectories of C:\Music and verify any par2 files it finds. -vrd C:\Music
This will check C:\Music\SomeCD and repair any damage it finds -fd C:\Music\SomeCD
You can get a full option list by running the script without any arguments. I created this for use with music files, but it should work for any kind of file.


MediaIntegrity v1.1 – When performing a verify operation the script will now prompt whether you want to repair the repairable files unless you specify the -n flag.

Old Versions

MediaIntegrity v1.0 – First Release.