Skip to content

bish bosh bash…

July 19, 2008

A friend gave me a CD full of jpg images… only the “.jpg” extensions were missing from the filenames. The macbook had no problems in viewing the files, but windows wasn’t having any of it unless I used Open As. And, of course, without any extension, I couldn’t “Always use this application for this file type” so I’d have to open each one of the eighty-odd images individually. Meh.

I’ve actually downloaded and used a freeware Bulk Rename Utility in Windows before, but it was really clunky. What I really needed was a script, and an OS that gave me instant access to a scripting language.

(Yes, this is another pro-mac post)

So, here is it, jpeg.sh in all it’s glory. Man, I *love* it when a plan comes together…

#!/usr/bin/env bash

for thing in “$@”
do
mv ${thing} ${thing}.jpg
done

then all that was needed was a quick

./jpeg.sh $(ls)

and I was done. (And, yes, it does rename jpeg.sh to jpeg.sh.jpg…)

UPDATE

me: Oh, btw, [a friend] has given us a CD of photos.

her: Yes, I’ve had a look at them. But I had to rename all the files to .jpg.

me: What? But I did that already! And put them [in the right place]!

her: Oh.

Advertisements

Comments are closed.

%d bloggers like this: