DOS scripting, hell yeah!

Woo, so to convert all my video files to FLV, I had decided to use ffmpeg. The issue was that all this was happening on a Windows PC. I faced the grim reality:

I need to recursively span directories and pass all movie files to ffmpeg

Pretty simple really… as a Perl or bash script… people could vote me off the Internet for posting such a silly event in a tech blog. But as I mentioned earlier, I was on Windows. Without Perl.

These are deep waters, Jeeves

-Bertram Wooster to Jeeves in “Very Good, Jeeves!”

Fortunately for me, a command to parse directories for specific file extensions is available in DOS. God is great, and so is Microsoft, sometimes.

So here goes,

for /R %A in ("*.avi" "*.mpg" ") do ffmpeg <options> -i %A %A.flv

With the power of for command (lots of switches and options available) and its combination with if command to prune the results, I see a lot of stuff that can be done right here in MS Dos. Not that I’d be keen to do it, but if time comes, Google and DOS won’t be a bad deal, I believe.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.