Software filter: looking for a free program to rename lots of image files...
July 9, 2007 8:23 PM   Subscribe

Software filter: looking for a free program to rename lots of image files...

I'm trying to get rid of stuff that i dont use, and i figured that two years worth of college notes would be a good place to start.
Two big boxes down to under 500mb. (mostly greyscale 100-150dpi .png files)
I used a brother MFC to scan them, but it doesn't do double sided scanning.
What i've done for double sided things is put them in a stack, scan the fronts, and then the backs.
I put the fronts one folder, and the backs in another folder.
My scanning software names each slide in numerical order (001, 002, 003, and so on).

So if i had a two page, double sided document (4 sides), page one and three (the fronts) would be in one folder and named 001 and 002.
Page two and four (the backs) would be in another folder and would be named 003 and 004.

Page: Name:
1 001
2 004
3 002
4 003

(of course i'm often dealing with a spiral notebook that contained 50-100 double-sided pages.)

Is there some software that i could use to put these back in order? I've searched google for freeware re-naming software and havent found anything all that useful.

I know i've had to write more complex sorting algorithms for the two java classes i took (before i changed my major...)
and it seems that it would be as easy as taking the first set of names, reading them into an array with a blank space after each one, and then reading in the second set of names in reverse order into those blank spaces. Then actually doing all that renaming nonsense (which is were i'd get into trouble).

Seriously, someone has to have written this before.
posted by itheearl to Computers & Internet (16 answers total) 4 users marked this as a favorite
You didn't state whether or not you're on a Windows or OS X box. I know there's going to be some pretty easy to use Applescripts for such a thing, but I don't know what's on the Windows side (though, yes, there's almost assuredly something out there for it)
posted by revmitcz at 8:38 PM on July 9, 2007

Honestly, writing it in perl would probably be faster than searching around for a program that does exactly the right thing. I mean, any general-purpose program is going to make you hack up a regular expression (or something like one) anyway, and that's probably the hardest part.

And yeah, there are perl installs for windows, e.g. ActiveState.
posted by rkent at 8:47 PM on July 9, 2007

Response by poster: Silly me.
Windows xp professional (32bit) sp2.
2ghz pentium m w/ 2gb ram

Also have Ubuntu linux on my spare desktop and could do it on that. (ive been playing around with Ubuntu and mythtv on it, but no luck with the wintv go card...)
Not much linux experience, especially when it comes to the command line, so graphical and easy to use would be nice... if not, good documentation (step-by-step) is a must.

If it helps, i have absolutely no qualms about trashing a windows installation over this. I need to reload anyway...
posted by itheearl at 8:51 PM on July 9, 2007

Response by poster: Oh, and i have a tiny bit of C / C++ experience...
absolutely no idea where to begin with pearl.
posted by itheearl at 8:52 PM on July 9, 2007

Response by poster: case in point, i just spelled it wrong
posted by itheearl at 8:53 PM on July 9, 2007

Response by poster: I suppose i could modify some existing code...
posted by itheearl at 8:54 PM on July 9, 2007

I like Lupas Rename. It's free.
posted by IndigoRain at 8:59 PM on July 9, 2007

Wait, you don't even need to do any sorting or reading of directories into arrays; there's a direct translation function for each set of pages.

If there are n sheets with 2 sides each, the algorithm to rename the fronts is:
new_name = (2 * old_name) - 1;
And to rename the backs it's:
new_name = 2 * ((2 * n) - old_name + 1);
(assuming you actually did the backs in reverse order). Come on, you can do that in perl, it'll take 10 minutes!
posted by rkent at 9:00 PM on July 9, 2007

Here's a perl file renaming tutorial (!). It'd probably be easier to use the built in rename function instead of calling system("mv $1 $2"), though.
posted by rkent at 9:09 PM on July 9, 2007

Is it that you have a zillion pages in just 2 directories, 'front' and 'back' (or whatever), with the pattern above increasing into large numbers? And in the end you'd like them united in one directory with filenames being numbers over the same range, just correctly corresponding to page number?

#!/usr/bin/perl -w
use strict;
use File::Copy;

my $total_pages = 8; # or whatever multiple of 4 is appropriate
my $dest_dir = "/tmp"; # or whatever

for my $x (0..(($total_pages/4)-1)) {
my $y = $x * 4;
move sprintf("front/%03d",$y+1), sprintf("%s/%03d", $dest_dir, $y+1);
move sprintf("front/%03d",$y+2), sprintf("%s/%03d", $dest_dir, $y+3);
move sprintf("back/%03d",$y+3), sprintf("%s/%03d", $dest_dir, $y+4);
move sprintf("back/%03d",$y+4), sprintf("%s/%03d", $dest_dir, $y+2);

posted by Zed_Lopez at 9:53 PM on July 9, 2007

Flexiable Renamer
posted by Coolcan2 at 10:44 PM on July 9, 2007

Best answer: The single most useful batch file renamer I've ever played with is the one built into irfanview. It's free, small, works on windows, and has a pretty intuitive graphical interface for the (relatively simple) rename function. It lets you do batch conversion/resizing of the images, too.

If I'm understanding you correctly (and based on my recollection), what'd you'd do is dump the first folder in, tell irfanview to sort it numerically, and then rename it to something like "### - _front" (where each # is a wildcard for a digit, and the underscore is for alphabetizing purposes) and let it output to a new folder. Spot check for glaring errors in ordering. If there are none, dump the second folder in, sort them in reverse order, and rename them "### - back". Hit f5, and the files should be in the desired order (with fronts first, thanks to the underscore):
001 - _front.jpg
001 - back.jpg

There's a tutorial on resizing here that should give you a sense of what the hell I'm talking about if you look at the screenshots (although, for some reason it doesn't show the sort button). Here's one on renaming.

Even with trial and error, it shouldn't take you more than 5 minutes if you've only got a front folder and a back folder and there are no surprises or anomalies in the naming scheme you described.

I've also used PFrank, which has always been overkill for me. I've heard good things about Rename-It, as well.
posted by averyoldworld at 1:00 PM on July 10, 2007

Hit f5, and the files should be in the desired order...

That is, hit f5 to refresh the view when you're looking at the output folder (as opposed to in irfanview). I'm sure you knew what I meant, but still.
posted by averyoldworld at 1:04 PM on July 10, 2007

I use Bulk Rename Utility a lot for renaming photos. It takes a few minutes to get used to, but it is powerful.

posted by Climber at 1:46 PM on July 10, 2007

There we go...
posted by Climber at 1:47 PM on July 10, 2007

Response by poster: F**king amazing.
Using infranview, i was able to increment the names by two, and the them into the 001, 002, 003, 004... order that i wanted. First try.
(even bypassed that 001_front, 001back thing).
Took only a matter of minutes to download, install, run, and sort my first notebook.
Now i can "flip" through pages of my class notes using windows picture and fax viewer (or any image viewer for that matter).

posted by itheearl at 10:14 PM on July 10, 2007

« Older Midnight Release Party At iTMS   |   ¡Bender! Newer »
This thread is closed to new comments.