[brlug-general] Script help
estrabd at gmail.com
Wed May 30 08:32:51 CDT 2007
On 5/30/07, Joe Fruchey <jfruchey at gmail.com> wrote:
> 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
> ... 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.
The "find" command should help you out.
> 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.
You'll have to write a script to parse the names and compare the
numbers. No utility will immediately do that - maybe some crazy perl
or sed oneliner, but nothing I am aware of.
> 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...
Sure, but this is something that could be easily done in bourne shell
with a "find" and a well placed "sort" - your call, obviously :).
> General mailing list
> General at brlug.net
estrabd at lsu.edu
estrabd at gmail.com
More information about the General