FileModifyDate not getting set on MacOS

Started by mdao, July 15, 2024, 09:14:38 PM

Previous topic - Next topic

mdao

Ok, first off, thank so much to Phil Harvey for creating and updating exiftool. Thanks to StarGeek and others who have posted suggestions and answers for everyone here.

Running MacOS 14.4
Running exiftool 12.89

I've searched and read forum posts for the last couple of hours but I was still not getting the results that I thought I should be getting. Everything worked great except for setting FileModifyDate.

I took a bunch of photos with camera set to wrong date time / timezone so ran an exiftool command to fix all that.

Now exif data looks like this:

% exiftool -time:all -s DSC00795.JPG
FileModifyDate                  : 2024:07:15 14:43:38-10:00
FileAccessDate                  : 2024:07:15 14:43:38-10:00
FileInodeChangeDate             : 2024:07:15 14:43:38-10:00
ModifyDate                      : 2024:06:06 12:52:12
DateTimeOriginal                : 2024:06:06 12:52:12
CreateDate                      : 2024:06:06 12:52:12
OffsetTime                      : +8:00
OffsetTimeOriginal              : +8:00
OffsetTimeDigitized             : +8:00
SonyDateTime                    : 2024:06:06 12:52:12
SubSecCreateDate                : 2024:06:06 12:52:12+8:00
SubSecDateTimeOriginal          : 2024:06:06 12:52:12+8:00
SubSecModifyDate                : 2024:06:06 12:52:12+8:00

My last step is to make the FileModifyDate the same as the DateTimeOriginal

% exiftool '-FileCreateDate<DateTimeOriginal' '-FileModifyDate<DateTimeOriginal' DSC00795.JPG
1 image files updated
% exiftool -time:all -s DSC00795.JPG
FileModifyDate                  : 2024:07:15 14:59:47-10:00
FileAccessDate                  : 2024:07:15 14:59:48-10:00
FileInodeChangeDate             : 2024:07:15 14:59:47-10:00
ModifyDate                      : 2024:06:06 12:52:12
DateTimeOriginal                : 2024:06:06 12:52:12
CreateDate                      : 2024:06:06 12:52:12
OffsetTime                      : +8:00
OffsetTimeOriginal              : +8:00
OffsetTimeDigitized             : +8:00
SonyDateTime                    : 2024:06:06 12:52:12
SubSecCreateDate                : 2024:06:06 12:52:12+8:00
SubSecDateTimeOriginal          : 2024:06:06 12:52:12+8:00
SubSecModifyDate                : 2024:06:06 12:52:12+8:00

Spent sometime trying all different commands to get the FileModifyDate to set correctly and finally discovered that I had to run the '-FileCreateDate<DateTimeOriginal' separately from the FileModifyDate (presumably the order of operations was to set FileModifyDate and then set FileCreateDate which reset FileModifyDate to the current time?)

% exiftool '-FileModifyDate<DateTimeOriginal' DSC00795.JPG
    1 image files updated
% exiftool -time:all -s DSC00795.JPG                     
FileModifyDate                  : 2024:06:06 12:52:12-10:00
FileAccessDate                  : 2024:06:06 12:52:12-10:00
FileInodeChangeDate             : 2024:06:06 12:52:12-10:00
ModifyDate                      : 2024:06:06 12:52:12
DateTimeOriginal                : 2024:06:06 12:52:12
CreateDate                      : 2024:06:06 12:52:12
OffsetTime                      : +8:00
OffsetTimeOriginal              : +8:00
OffsetTimeDigitized             : +8:00
SonyDateTime                    : 2024:06:06 12:52:12
SubSecCreateDate                : 2024:06:06 12:52:12+8:00
SubSecDateTimeOriginal          : 2024:06:06 12:52:12+8:00
SubSecModifyDate                : 2024:06:06 12:52:12+8:00

Posting this here to see if my understanding is correct (ie, use FileModifyDate only on MacOS) and hopefully to help anyone else who has this issue in the future.

wywh

I have used this to copy filenames to image metadata dates:

exiftool -m -overwrite_original '-AllDates<FileName' '-FileCreateDate<FileName' '-FileModifyDate<FileName' .
Previously I used -overwrite_original_in_place but noticed that then the creation date would move only backwards. I still sometimes use that but using only -overwrite_original makes the command simpler.

With -overwrite_original_in_place, -execute must be used because then FileCreateDate can move also forwards in time (when '-execute is used', then all arguments following '-common_args' option are common to all executed commands. '-common_args' option and its arguments MUST come after all other options on the command line). For example to copy filename to movie metadata dates:

exiftool -api QuickTimeUTC=1 '-AllDates<FileName' '-Track*Date<FileName' '-Media*Date<FileName' '-Keys:CreationDate<FileName' -execute '-FileCreateDate<FileName' '-FileModifyDate<FileName' -common_args -m -overwrite_original_in_place -wm w -api LargeFileSupport=1 .
Finder color tags survive -overwrite_original and also for XAttrMDItemWhereFroms -overwrite_original is enough. On the other hand, MDItemFSFinderFlags and MDItemFSLabel (the very last of the XAttrMDItemUserTags that some apps like GraphicConverter Browser use) need -overwrite_original_in_place to survive.

Those commands might ask for Xcode Command Line Tools install which might be ignored (the install is quite small and fast, not the huge Xcode install, so you might install it to get rid of that nag).

- Matti