Author Topic: BUG: Fragmentary File number  (Read 2279 times)

JanK

  • Full Member
  • ***
  • Posts: 83
BUG: Fragmentary File number
« on: December 18, 2011, 08:20:31 AM »
Mac OSX Lion 10.7.2
Exiftool 8.73 (this bug was in version before too)

I have a folder of 2136 pictures and rename them with
exiftool '-filename<%1.4C_FixNameOfEvent_${datetimeoriginal}.%e' -d %Y-%m-%d -fileorder datetimeoriginal# DIR

I should get a continuous number at the beginning from 0001 to 2136. But what I get is some breaks in the number.
0001-0015 (2010.06.15)
0027-0130 (2010.08.28 ; 2010.09.01)
0786-1525 (2010.09.02 ; 2010.09.03)
1822-3061 (2010.09.04 ; 2010.09.05 ; 2010.09.19 ; 2011.01.22)

In the brackets you can see the dates of the pictures in this line. When there is a break in the number it is always at the end of a date (But not at the end of every date). You see this because in some range are more then one dates.

I had this bug days before too but with execute the command again the numbers were fixed (So it did not report this bug). There it was not the problem that I have some breaks in the middle but it starts not with 0001. In this fact I had renamed the pictures so I have a number from 0001 to 0347. Because I want change the name I execute the command again and the first file starts with 0348. That is interesting because in the run before it ends with 0347. Execute it again let the filename start with 0001. Maybe this information could help.
Today I saw this bug again with my 2136 files and here it helps to execute the command again too. But this could not be the workflow.
I can not reproduce this bug so it's difficult to say why this happen.


Next is a list of the date/time from the files which have a break in the number

0015
Code: [Select]
[System]        FileModifyDate                  : 2010:06:15 16:47:00+02:00
[IFD0]          ModifyDate                      : 2010:06:15 16:47:00
[ExifIFD]       DateTimeOriginal                : 2010:06:15 16:47:00
[ExifIFD]       CreateDate                      : 2010:06:15 16:47:00

0027
Code: [Select]
[System]        FileModifyDate                  : 2010:08:28 06:00:00+02:00
[IFD0]          ModifyDate                      : 2010:08:28 06:00:00
[ExifIFD]       DateTimeOriginal                : 2010:08:28 06:00:00
[ExifIFD]       CreateDate                      : 2010:08:28 06:00:00

0130
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 21:01:59+01:00
[IFD0]          ModifyDate                      : 2010:09:01 18:44:10
[ExifIFD]       DateTimeOriginal                : 2010:09:01 18:44:10
[ExifIFD]       CreateDate                      : 2010:09:01 18:44:10

0786
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 20:46:42+01:00
[IFD0]          ModifyDate                      : 2010:09:02 14:47:38
[ExifIFD]       DateTimeOriginal                : 2010:09:02 14:47:38
[ExifIFD]       CreateDate                      : 2010:09:02 14:47:38

1525
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 20:59:52+01:00
[IFD0]          ModifyDate                      : 2010:09:03 14:59:36
[ExifIFD]       DateTimeOriginal                : 2010:09:03 14:59:36
[ExifIFD]       CreateDate                      : 2010:09:03 14:59:36

1822
Code: [Select]
[System]        FileModifyDate                  : 2010:09:04 00:33:44+02:00
[IFD0]          ModifyDate                      : 2010:09:04 00:33:44
[ExifIFD]       DateTimeOriginal                : 2010:09:04 00:33:44
[ExifIFD]       CreateDate                      : 2010:09:04 00:33:44

This pictures have a date/time jump but the counter is correct

0106
Code: [Select]
[System]        FileModifyDate                  : 2010:08:28 20:41:45+02:00
[IFD0]          ModifyDate                      : 2010:08:28 20:41:45
[ExifIFD]       DateTimeOriginal                : 2010:08:28 20:41:45
[ExifIFD]       CreateDate                      : 2010:08:28 20:41:45

0107
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 21:01:57+01:00
[IFD0]          ModifyDate                      : 2010:09:01 18:10:49
[ExifIFD]       DateTimeOriginal                : 2010:09:01 18:10:49
[ExifIFD]       CreateDate                      : 2010:09:01 18:10:49

1520
Code: [Select]
[System]        FileModifyDate                  : 2010:09:02 21:34:07+02:00
[IFD0]          ModifyDate                      : 2010:09:02 21:34:07
[ExifIFD]       DateTimeOriginal                : 2010:09:02 21:34:07
[ExifIFD]       CreateDate                      : 2010:09:02 21:34:07

1521
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 20:59:52+01:00
[IFD0]          ModifyDate                      : 2010:09:03 14:39:15
[ExifIFD]       DateTimeOriginal                : 2010:09:03 14:39:15
[ExifIFD]       CreateDate                      : 2010:09:03 14:39:15

2852
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 20:55:34+01:00
[IFD0]          ModifyDate                      : 2010:09:04 23:58:38
[ExifIFD]       DateTimeOriginal                : 2010:09:04 23:58:38
[ExifIFD]       CreateDate                      : 2010:09:04 23:58:38

2853
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 20:58:54+01:00
[IFD0]          ModifyDate                      : 2010:09:05 00:03:38
[ExifIFD]       DateTimeOriginal                : 2010:09:05 00:03:38
[ExifIFD]       CreateDate                      : 2010:09:05 00:03:38

3049
Code: [Select]
[System]        FileModifyDate                  : 2011:12:13 21:02:14+01:00
[IFD0]          ModifyDate                      : 2010:09:05 18:52:49
[ExifIFD]       DateTimeOriginal                : 2010:09:05 18:52:49
[ExifIFD]       CreateDate                      : 2010:09:05 18:52:49

3050
Code: [Select]
[System]        FileModifyDate                  : 2010:09:19 11:32:38+02:00
[IFD0]          ModifyDate                      : 2010:09:19 11:32:38
[ExifIFD]       DateTimeOriginal                : 2010:09:19 11:32:38
[ExifIFD]       CreateDate                      : 2010:09:19 11:32:38

3056
Code: [Select]
[System]        FileModifyDate                  : 2010:09:19 11:33:21+02:00
[IFD0]          ModifyDate                      : 2010:09:19 11:33:21
[ExifIFD]       DateTimeOriginal                : 2010:09:19 11:33:21
[ExifIFD]       CreateDate                      : 2010:09:19 11:33:21

3057
Code: [Select]
[System]        FileModifyDate                  : 2011:01:22 13:20:58+01:00
[IFD0]          ModifyDate                      : 2011:01:22 13:20:58
[ExifIFD]       DateTimeOriginal                : 2011:01:22 13:20:58
[ExifIFD]       CreateDate                      : 2011:01:22 13:20:58
-Mac OSX Mountain Lion-

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: BUG: Fragmentary File number
« Reply #1 on: December 18, 2011, 02:09:56 PM »
Very interesting.  I'm not sure this is a bug.  I will explain what is happening:

If you rename a file using %C in the new filename string, and the new file already exists, then the number will increment past the existing file to avoid a conflict.  However, if the existing file is subsequently renamed (by the same command), then there will be a gap in the file numbers.  ExifTool doesn't issue a warning in this case, it just happily increments the number whenever a conflict occurs.

To work around this, you could make sure that there won't be any conflicts before renaming the files to something else before changing them back again.  For example:

exiftool '-filename<%1.4C_tmp.%e' DIR

exiftool '-filename<%1.4C_FixNameOfEvent_${datetimeoriginal}.%e' -d %Y-%m-%d -fileorder datetimeoriginal# DIR


Another work-around would be to move the files to a new directory when you rename them.

exiftool '-filename<newdir/%1.4C_FixNameOfEvent_${datetimeoriginal}.%e' -d %Y-%m-%d -fileorder datetimeoriginal# DIR

Then move them back again afterwards.

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