Saturday, August 28, 2010

I wrote a program today to organize photos. I have a great number of photos from over the years; they were mostly organized at some time in the past, but got copied wholesale to new hard drives when it was time to migrate, or got stowed in a tarball somewhere, etc... anyway this program i wrote (in perl) will, given a source directory and a target directory, iterate through the source directory finding files matching a given file type (in this version, jpg and cr2, but that can change), extract the creation date from the file's EXIF data, create a directory tree (as needed) under the target path as year/month/day and either move or copy the file into that directory. I'm going to post the code now, but it's not totally mature and it's not yet commented at all. have a gander if you like. I intend to improve this in the future but no promises are made. also i guarantee it not to bug-free.

I'm releasing this under the GPL, v3 which can be found at

#!/usr/bin/perl -w -- call this version 0.01

use strict;
use File::List;
use File::Copy;
use File::Path;
use Image::ExifTool;
use File::Basename;

my $basedir = "put path to source here";
my $target = "put path to target here";
my $i = 0;

my $search = new File::List("$basedir");
my $fileArrRef = $search->find("JPG\$|jpg\$|cr2\$|CR2\$");

sub pathbuild {
    my $newpath = $_[0];
    if (! -d $newpath) {
        if ( -e $newpath ) {
    return $!;

my $dtOrig;my $date;my $time;my $yr;my $mo;my $day;
foreach my $fullname (@$fileArrRef) {
    my $info = Image::ExifTool::ImageInfo($fullname);
    if ($$info{DateTimeOriginal}) {
        $dtOrig = $$info{DateTimeOriginal};
        ($date,$time) = split( / /, $dtOrig);
        ($yr,$mo,$day) = split(/:/, $date);
    } else {
        $dtOrig = '';
    my ($name,$path,$ext) = File::Basename::fileparse($fullname,qr/jpg|cr2/i);
    my $dest = "$target/undated";
    if ($dtOrig) {
        $dest = "$target/$yr/$mo/$day"

    my $destfile = "$dest/$name$ext";
    $i = 0;
    while (-e $destfile){
        $destfile = "$dest/$name$i.$ext";
    if (link ($fullname,$destfile)){
        unlink ($fullname);
    } else {
        copy ($fullname,$destfile);

Monday, May 24, 2010

Trivial? Not sure, but it's trivia in any case.

Announcing a Trivia Challenge, with a Prize:

There's something very interesting about the subject of the photo in this link. See if you figure out what it is, and why it's like that.

The first ten people to flickr-mail or email me with
[1] the interesting fact about the subject of the photo
[2] the specifics of why that fact is the case
Will receive an 8x10 print (or similar size, exact dimension depends on photo dimension) of any of my work on flickr of your choosing (excluding low-res work and photos of people).

This is open to everyone, and no information sources are off-limits (but do your own research please).



PS - tell your friends to check it out, because the photo's been viewed over 200 times but I've only gotten one right answer!!

Friday, February 12, 2010

"Margaret was always a precocious child."

A short exchange between me and Maggie yesterday while driving home...

Maggie: *coughs* "I farted!"
Me: "Honey, that was a cough."
Maggie: "I did both at once."
Me: "Wow, you're multi-talented!"
Maggie: "Ta-da!!"

change of pace

Since I'm back in school now and the weather has been terrible, I really haven't been able to update this blog with anything relevant. Consequently, I think I will proceed to update with things that are irrelevant.

Tuesday, January 26, 2010

We have completed repair of the reported street light. Thank you again for reporting street light outages.

I'm starting to love getting those emails. The ones I don't like as much say "CenterPoint Energy has investigated your outage request. The work necessary to repair the street light has been assigned to a crew and should be complete in approximately 2-3 weeks. Thank you for reporting street light outages." However, even these seem generally to have been finished well under the time mentioned; I'll have to go back and check out these specific ones.

I need to update the map to include these new fixes; I will when I get a few spare moments...

Unfortunately it's crunch time at work for Nicole and I have just started a new semester. The new challenge will be keeping up this effort when all my time seems to be allocated in advance.

Sunday, January 17, 2010

Lots of walking

Maggie was hell on wheels today. None of the usual tricks to keep her behavior in line were working at all, so we spent a lot of time walking outside -- it's usually the only thing that'll work when all else fails to keep her attention. In today's case, we went for two extended walks, mainly to keep her from wrecking the house and the sanity of all its residents (Molly had a major meltdown today as well, but that's a story for another posting).

Since we were out walking on a beautiful sunny day anyway, we passed some of the time by looking for street lights on during the day. We covered probably 2.5 miles all told, which for a 5-year-old unused to much physical activity is rather a lot. I think it helped that we did it in two parts; she never would have been able to do it all at once: she was complaining about wanting to see mama, how her feet were bothering her, how she was sweaty, how her leg itched -- all before we were two thirds done with the first loop.

The second loop was actually quite a bit longer than the first, but I employed the additional strategy of bringing along Nicole (mom), Molly (little sister), and a pair of binoculars. OK, to be fair, Molly's presence is pretty irrelevant to Maggie (or perhaps I should say she functions as an obstacle for Maggie most of the time). Nicole, though, provided a foil -- when she's out with us, Maggie has less reason to complain about wanting to go home. Her feet might still hurt, but any complaints about discomfort are much more likely to be genuine than when mom's waiting at home. Predictably, therefore, Maggie happily walked most of a mile before complaining at all. As to the binoculars, their benefit was twofold. First, the novelty value of being able to look at stuff through them can't be understated, and the longer one is out of the house, the more one can use the binoculars. Second, they allowed me to look down streets for lit streetlights without having actually to go down the streets unnecessarily. There's nothing like a fruitless expedition to lose the interest of a five-year-old, and those binoculars allowed me to determine in advance whether we needed to go down streets or not to get numbers from poles, and I'm satisfied they prevented their fair share of frustration on Maggie's part.

We've gotten to the point that we've covered a significant portion of the neighborhood looking for lights that are dim and out at night, and with today's effort, on during the day. I spent some time after today's walk marking on a Google map the territory we'd covered. I'm sharing the link;
have a look.

Saturday, January 9, 2010

not dead

This is just an update to say that we're not dead, it's just been too busy and too darned cold to do much on the lights front. Hopefully I'll have something more interesting to say before too long.