Thursday, October 16, 2008

Shell Scripting

One thing that Linux and its brethren have always done well is shell scripting. Windows users are unfortunately missing out on this wonderful tool.

Oh, sure, Windows has DOS .bat and .cmd files, PowerShell scripts, and VBScript .vbs files. That's three different scripting languages to learn, if you want to work with other people (since in a group, someone else is bound to prefer something different than you). Plus, I have an intense dislike of VBScript, mainly for reasons like this:

Three lines to copy a file? Honestly? Anyway, I digress.

Shell scripting may not always be clear, but it does provide powerful tools for doing tasks that would otherwise take forever. Here are a few examples that may help with your media collection:

Rename with Lowercase Extensions

This will rename all files in the current directory and all subdirectories to have lower-case file extensions. It also demonstrates how you may get around the spaces-in-filenames issue that plagues most script writers:

Convert All Files to AVI

Here is one example that I use regularly at home. It takes all non-AVI files in this and all subdirectories and makes them into 2-pass encoded XviD AVIs using MEncoder. My wife and I own a DVD player that plays DivX/XviD files, so this makes any videos we may acquire playable on it:

I hope these are useful. Check back again for other scripting tips.

No comments: