[brlug-general] Script help

Joe Fruchey jfruchey at gmail.com
Wed May 30 08:12:32 CDT 2007


I've been using F-Spot for photo organization lately. I like how it
automatically copies files into a date-based directory structure,
unlike Picasa which makes you sort it out yourself.

I inadvertently double-imported some photos. F-Spot has named those
photos XXXX-1.JPG

In all subdirectories of my ~/Photos directory, I would like to MOVE
all *-1.[JPG,jpg] to ~/Photos/dupes. That's the easy part. Then, I
want to COPY the associated non-1 file to dupes as well, that way I
can manually check to see if there are any that are not actually
dupes. Also, if XXX-1 exists, but XXX does not, I want to leave XXX
alone.

... Is there an easy way to traverse subdirectories? I saw that mv
doesn't have an available -R option, but cp and rm do... but that only
seems to work if you're copying or deleting an entire directory.

Anyhow, the second thing I want to do is search for files by number.
For instance, my camera produces images named P1010001.JPG. I want a
script that will check my ~/Photos directory and, for instance, if it
finds P1040586.JPG, then P1040622.JPG, with no intermediates, notify
me so I can be aware that I'm missing a chunk of photos. If it can
display EXIF data, that'd be great too, and maybe even a thumbnail.

I'm not asking anyone to write these scripts for me, but rather to
point me in the direction of some resources that may help me. Can this
be done with Python? I've been wanting to learn Python anyway...




More information about the General mailing list