Image renaming and organization woes

Started by Archive, May 12, 2010, 08:54:40 AM

Previous topic - Next topic

Archive

[Originally posted by philh on 2009-09-26 20:24:11-07]

Hi all,

I'm attempting to organize .CR2 files and generate a numerical output.

For example I want to take these:

IMG_9879.CR2

IMG_9880.CR2

IMG_9881.CR2

And transform them to these:

0001_20090926.CR2

0002_20090926.CR2

0003_20090926.CR2

I've search the cpan ExifTool threads and found this:

http://www.cpanforum.com/threads/10936" target="_blank">http://www.cpanforum.com/threads/10936

Which provides the sequential numbering, but I'm having issues.

I'm having two main problems.  Organizing by "createdate" works well, but runs into problems when images were shot the same second.  Also, once the camera begins to renumber again from "0" it can potentially throw off the numbering of a sequence. I can't seem to find a combination of the -C or -c options that will help me out.

I know others out there must have experienced this, any help would be greatly appreciated.

Thanks,

Phil

Archive

[Originally posted by exiftool on 2009-09-26 21:34:52-07]

Hi Phil,

It sounds like you want to number images for a given day
beginning with 0001_ and numbering sequentially, with
the date in the file name too.  Did you try something like this?:

Code:
exiftool -d %%.4nc_%Y%m%d.%%e "-filename<createdate" DIR

where DIR is the directory containing the images.

- Phil

Archive

[Originally posted by philh on 2009-09-26 21:56:26-07]

Thanks Phil!

I've tried to make that fail and it seems to have solved the problem.  That does seem to keep them in the correct order! Although, I did reverse the output to:

"20090921_0001.CR2"

So the files are easily sortable by shooting date. After that though, I am now thinking of another question.

Is it possible to have exiftool drop files into folders based on date like:

"/2009_09_26/"

And name the files:

"image_0001.CR2"

All from one command?

Thanks so much. You've written an extremely useful program and I can't tell you how much it's helped already.

Cheers,

Phil

Archive

[Originally posted by exiftool on 2009-09-27 10:47:11-07]

Hi Phil,

The ordering of the %c numbers is set only by the order of processing
the files.  This is usually the same order as you get when you do a
directory listing, which on most systems is sorted alphabetically.
Luckily this works for you since your images are in chronological
order when the file names are sorted like this.

But to answer your question:  Yes, you can move the files to
a folder based on date.  To do this, just add a directory specification
to the filename string.  ie)

Code:
exiftool -d %Y%m%d/image_%%.4nc.%%e "-filename<createdate" DIR

In case you have more questions,
https://exiftool.org/filename.html" target="_blank">this
page may help answer them since it has an explanation with examples
of some of these features.

- Phil