Write an incremental value based on a date

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

Previous topic - Next topic

Archive

[Originally posted by raterus on 2009-02-20 15:09:07-08]

Hello,

I'm going back and renaming my old images to a more usable format.  I'm working off the ShutterCount tag, but unfortunately I have many images that don't have that tag written.

I'd like to write this value to all my images that don't have it, based on the date the picture was taken.  This is probably a far-stretch of exiftool's limits, but is it possible to look at a directory, sort by the dateTimeOriginal tag (or even just the filename), then write to the ShutterCount exif an incremental integer value.  So the first image taken in the directory gets 1, second gets 2, and so on?

Thanks!
--Michael

Archive

[Originally posted by exiftool on 2009-02-20 16:07:22-08]

Hi Michael,

There are 2 problems with what you suggest:

1) shutterCount is a proprietary tag that can't be added to an image

2) it is difficult to write a value that increments as you describe

Instead, I would recommend renaming the images
using the copy number (%c) to avoid collisions:

Code:
exiftool -d %y%m%%.4c.jpg "-filename<datetimeoriginal" -if "not $shutterCount" DIR

The above command will do this for all files without a ShutterCount
(or with a shutterCount of zero) in directory DIR.

Alternatively, you could use %H%M%S to add the time to the file
names instead of an arbitrary copy number.

- Phil