Find files which have exactly the same DateTime

Started by JanK, November 03, 2012, 09:24:54 AM

Previous topic - Next topic

JanK

Hi!

My old way to rename the files
In the past I named my pictures "Name_YYYY-MM-DD_0001_PictureJohn.jpg". I use a continuous number (0001, 0002,...) instead of HH-MM-SS because in some folders I have pictures with completely the same DateTime (Taken by different photographers).

Problem with this name
In the last time I get some trouble with adding new pictures to an existing folder. Some pictures which have to be added to this folder are older then the last pictures in the existing folder. So they have to be added in the middle instead of the end. With my (0001, 0002,...) in the files I have to rename all of my pictures.

My change
When I use no continuous number but YYYY-MM-DD_HH-MM-SS I do not have this problem. It rearrange the files automatically because of the filename. So my new filename looks like that "Name_YYYY-MM-DD_HH-MM-SS_PictureJohn.jpg"

Question
I get an error with exiftool doing this because of the same DateTime of some files. It would create two files with the same name. So at first I have to find out which files have the same DateTime to push one of it one second to the future. I can rename the files not until all files have a different DateTime.
-Mac OSX Mountain Lion-

Phil Harvey

I suggest you add "%lc" in the file name format string to add "b", "c", "d" etc to the images which would otherwise have the same name.  Changing the times to avoid duplicates doesn't seem right.  However, you can do this if you want by repeating the renaming command with a -globaltimeshift option, with shifts of "+0:0:1""+0:0:2""+0:0:3" etc until there are no more files to rename.

Note that there was a bug in the -globalTimeShift option prior to ExifTool 9.04 which may prevent it from working as designed, so if you do this you should download the latest version.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JanK

Thanks Phil!

I use %lc for now and every renaming. It will only effect when there are files with the same date. So thats a good choice.
With that I can generate a new filename structure for all my files. Do you have an idea which one I should take? Your opinion?

HolidayNewYork_2010-09-29_18-34-56_PictureJohn.jpg (clearly represented)

HolidayNewYork_20100929-183456_PictureJohn.jpg (a little bit shorter)


Thanks!
-Mac OSX Mountain Lion-

Phil Harvey

Your question is quite subjective, but personally I think I would prefer something like this:

HolidayNewYork_2010-09-29_183456_PictureJohn.jpg,

but mainly because I don't like the dashes as separators in the time part.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JanK

Thank you. I thought about it the last day. I will take 20100929-183456 It looks like the two date and time belong more together.

Furthermore I know %.10f. It represents everything from the filename without the first ten characters. Is there an option which represents everything after the second "_"? Meaning with the filename HolidayNewYork_20100929-183456_PictureJohn.jpg I will only have PictureJohn.
-Mac OSX Mountain Lion-

Phil Harvey

Quote from: JanK on November 08, 2012, 11:15:55 AM
Is there an option which represents everything after the second "_"?

You could do this with a user-defined tag and this conversion.

    ValueConv => '$val =~ /([^_]+)\./ ? $1 : undef',

This returns all contiguous non-underline characters immediately before the "." in the string.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JanK

Thanks so much.

This saves a lot of work to rename all my files. I hope the last time.
I generate a composite tag with that and use it for this. So I only have to change the NameOfEvent and the directory.
-Mac OSX Mountain Lion-