ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: mkl on March 10, 2025, 04:22:57 PM

Title: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: mkl on March 10, 2025, 04:22:57 PM
/inputdir/ contains one file, test.raf.

This is what Time/Date metadata says:
exiftool -time:all -G1 -a -s /inputdir/test.raf
[System]        FileModifyDate                  : 2020:07:28 18:16:50+02:00
[System]        FileAccessDate                  : 2020:07:28 18:16:50+02:00
[System]        FileInodeChangeDate             : 2020:07:28 18:16:50+02:00
[IFD0]          ModifyDate                      : 2020:07:28 18:16:48
[ExifIFD]       DateTimeOriginal                : 2020:07:28 18:16:48
[ExifIFD]       CreateDate                      : 2020:07:28 18:16:48

Let's shift time forward 1 hour.
exiftool -P -ext raf -AllDates+=1:00 /inputdir/test.raf
Now metadata says:
[System]        FileModifyDate                  : 2020:07:28 18:16:50+02:00
[System]        FileAccessDate                  : 2020:07:28 18:16:50+02:00
[System]        FileInodeChangeDate             : 2020:07:28 18:16:50+02:00
[IFD0]          ModifyDate                      : 2020:07:28 19:16:48
[ExifIFD]       DateTimeOriginal                : 2020:07:28 19:16:48
[ExifIFD]       CreateDate                      : 2020:07:28 19:16:48

FileModifyDate, FileAccessDate and FileInodeChangeDate did not shift 1 hour. -P works for preserving Date/Time for FileModifyDate, FileAccessDate and FileInodeChangeDate, but then it's the old date/time (2020:07:28 19:16:48) that's preserved.

exiftool "-FileModifyDate<DateTimeOriginal" /inputdir/test.raf shifts FileModifyDate, but not FileAccessDate and FileInodeChangeDate.

Is there a way to shift all? What's bothering me is that my file manager (Dolphin) shows the wrong time by one hour.
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: mkl on March 10, 2025, 04:39:54 PM
Oh sorry, for some reason it all works now. Here's what I did:

exiftool -time:all -G1 -a -s /inputdir/test.raf
[System]        FileModifyDate                  : 2020:07:28 18:16:50+02:00
[System]        FileAccessDate                  : 2020:07:28 18:16:50+02:00
[System]        FileInodeChangeDate             : 2020:07:28 18:16:50+02:00
[IFD0]          ModifyDate                      : 2020:07:28 18:16:48
[ExifIFD]       DateTimeOriginal                : 2020:07:28 18:16:48
[ExifIFD]       CreateDate                      : 2020:07:28 18:16:48

exiftool -P -ext raf -AllDates+=1:00 /inputdir/test.raf
exiftool -time:all -G1 -a -s /inputdir/test.raf

[System]        FileModifyDate                  : 2020:07:28 18:16:50+02:00
[System]        FileAccessDate                  : 2020:07:28 18:16:50+02:00
[System]        FileInodeChangeDate             : 2020:07:28 18:16:50+02:00
[IFD0]          ModifyDate                      : 2020:07:28 19:16:48
[ExifIFD]       DateTimeOriginal                : 2020:07:28 19:16:48
[ExifIFD]       CreateDate                      : 2020:07:28 19:16:48


exiftool "-FileModifyDate<DateTimeOriginal" /inputdir/test.raf
exiftool -time:all -G1 -a -s /inputdir/test.raf
[System]        FileModifyDate                  : 2020:07:28 19:16:48+02:00
[System]        FileAccessDate                  : 2020:07:28 19:16:48+02:00
[System]        FileInodeChangeDate             : 2020:07:28 19:16:48+02:00
[IFD0]          ModifyDate                      : 2020:07:28 19:16:48
[ExifIFD]       DateTimeOriginal                : 2020:07:28 19:16:48
[ExifIFD]       CreateDate                      : 2020:07:28 19:16:48

"-FileModifyDate<DateTimeOriginal" seems to fix FileAccessDate and FileInodeChangeDate too.
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: mkl on March 10, 2025, 04:52:33 PM
I should perhaps add that running both exiftool "-FileModifyDate<DateTimeOriginal" /inputdir/test.raf and exiftool -P -ext raf -AllDates+=1:00 /inputdir/test.raf generated this output:
Warning: unable to close filehandle FH properly: Operation not permitted at /home/linuxbrew/.linuxbrew/Cellar/exiftool/13.10/libexec/lib/Image/ExifTool/Writer.pl line 7037.

The command worked though.
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: StarGeek on March 10, 2025, 06:36:40 PM
Quote from: mkl on March 10, 2025, 04:22:57 PMFileModifyDate, FileAccessDate and FileInodeChangeDate did not shift 1 hour. -P works for preserving Date/Time for FileModifyDate, FileAccessDate and FileInodeChangeDate, but then it's the old date/time (2020:07:28 19:16:48) that's preserved.

AllDates is a Shortcuts tag (https://exiftool.org/TagNames/Shortcuts.html) for the three most common EXIF timestamps, CreateDate, DateTimeOriginal, and ModifyDate. It doesn't edit any tags that do not have these names.

Quoteexiftool "-FileModifyDate<DateTimeOriginal" /inputdir/test.raf shifts FileModifyDate, but not FileAccessDate and FileInodeChangeDate.

See the entries for the last two on the Extra Tags page (https://exiftool.org/TagNames/Extra.html). You will see that both of these have a "no" entry in the writable column. As you discovered, these may be set to the same time as FileModifyDate when that is altered.

There is absolutely no point in trying to edit the FileAccessDate, as that will be changed if the file is touched in anyway, such as opening an image for viewing.

QuoteIs there a way to shift all? What's bothering me is that my file manager (Dolphin) shows the wrong time by one hour.

The AllDates shortcut will shift the main EXIF tags and FileModifyDate is marked as Avoid, so it can only be altered by explicitly naming it.
exiftool -AllDates+=1 -FileModifyDate+=1 /path/to/files/

Quote from: mkl on March 10, 2025, 04:52:33 PMI should perhaps add that running both
exiftool "-FileModifyDate<DateTimeOriginal" /inputdir/test.raf and
exiftool -P -ext raf -AllDates+=1:00 /inputdir/test.raf generated this output:
Warning: unable to close filehandle FH properly: Operation not permitted at /home/linuxbrew/.linuxbrew/Cellar/exiftool/13.10/libexec/lib/Image/ExifTool/Writer.pl line 7037.

The command worked though.

Did you run both of these at the same time?  That would be the reason for that error. One instance of exiftool has a lock on the file at the same time as the other.
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: mkl on March 11, 2025, 04:31:31 AM
Quote from: StarGeek on March 10, 2025, 06:36:40 PMAllDates is a Shortcuts tag (https://exiftool.org/TagNames/Shortcuts.html) for the three most common EXIF timestamps, CreateDate, DateTimeOriginal, and ModifyDate.
Thanks for clarifying!

Quote from: StarGeek on March 10, 2025, 06:36:40 PMDid you run both of these at the same time?  Did you run both of these at the same time?  That would be the reason for that error. One instance of exiftool has a lock on the file at the same time as the other.
Nope, I ran one after the other.

First exiftool -P -ext raf -AllDates+=1:00 /inputdir/test.raf
Thenexiftool "-FileModifyDate<DateTimeOriginal" /inputdir/test.raf
Both gave that error.

Quote from: StarGeek on March 10, 2025, 06:36:40 PMFileModifyDate is marked as Avoid
What is the reason for this?
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: StarGeek on March 11, 2025, 11:27:24 AM
Quote from: mkl on March 11, 2025, 04:31:31 AM
Quote from: StarGeek on March 10, 2025, 06:36:40 PMFileModifyDate is marked as Avoid
What is the reason for this?

My mistake, it's not marked Avoid, it's marked Unsafe. One reason would be that some backup programs rely on the file system time stamps to know if a file has been modified and needs to be backed up. It's one of the main purposes of that time stamp. If it was indiscriminately copied, some file might not get backed up that need to be.
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: mkl on March 12, 2025, 06:17:36 AM
Quote from: StarGeek on March 11, 2025, 11:27:24 AM
Quote from: mkl on March 11, 2025, 04:31:31 AM
Quote from: StarGeek on March 10, 2025, 06:36:40 PMFileModifyDate is marked as Avoid
What is the reason for this?
My mistake, it's not marked Avoid, it's marked Unsafe. One reason would be that some backup programs rely on the file system time stamps to know if a file has been modified and needs to be backed up. It's one of the main purposes of that time stamp. If it was indiscriminately copied, some file might not get backed up that need to be.
OK, makes sense, thanks!
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: mkl on March 13, 2025, 08:00:27 AM
Quote from: mkl on March 10, 2025, 04:52:33 PMWarning: unable to close filehandle FH properly: Operation not permitted at /home/linuxbrew/.linuxbrew/Cellar/exiftool/13.10/libexec/lib/Image/ExifTool/Writer.pl line 7037.
I wonder if this had something to do with me operating remotely on an SMB share. Problem seems to have gone away when I used ExifTool directly from the FreeBSD based server.
Title: Re: Changing all dates (even FileModifyDate, FileAccessDate and FileInodeChangeDate)
Post by: Phil Harvey on March 13, 2025, 08:52:48 AM
We have definitely seen some oddities with SMB shares.

- Phil