BrakeBlog

Local photography, National rants, Zero navel-gazing allowed… Blogging from Hopkinsville, KY

Useful scripting from a non-expert

I’m not a programmer. It’s almost embarrassing how long it takes me to write a short script, but I am learning as I find new tasks that are scriptable. Finding scriptable tasks was my problem during my first attempts at learning Python while I was still on Windows. I remember learning Python and experimenting with it but having no idea what I could do with it. Now that I run on Gentoo Linux exclusively I see many oportunities for scripting. Of course, the internals of Windows are not exposed unless you pay money to get the necessary tools and insider access via MSDN, etc. On Linux, all of the MSDN equivalents and more are freely available. For new potential programmers, what is more likely to be your first learning language? Python or Visual Basic?

My most recent piece of scripting grew from work I was doing to rip my music to FLAC then transcode the FLAC files into mp3. Given that FLAC audio is lossless it is an excellent archival format I wanted to guarantee that the FLAC files I create today would be the same pristine files a year from now. The obvious answer was to checksum everything with sha1sum and burn it to DVD. Yeah, what now? I have a directory structure of several hundred files and more than a dozen checksum files. The manual process of checking this structure can be automated very effectively with a shell script.

First of all, tools like sha1sum or even md5sum aren’t available on a Windows system. In order to do the same thing I’d have to search for a Windows implementation. On Linux, this is one of many tools that is expected to be there already. Waiting for some idiot like me to glue the components together and create something useful. Linux started in an academic environment and to this day Linux has the components to bootstrap your own education.

Download sha1sum_chk


Posted

in

,

by

Tags: