Date Handling Problem on dates in the region of c.1904 c1925

Started by Paul Barrett, September 27, 2016, 02:15:53 PM

Previous topic - Next topic

Paul Barrett

Win 10 Home on 64 bit Intel system
Exiftool version 10.11

Expectation: Change File Modified date to match Date/Time Original. 

Problem: Dates in the range 1904 - 1925 are incorrectly updated to 2014 -2025  Later dates are OK and I have done many of them from 1930 through to 1970.  I don't have images for all years so don't know where the tipping is exactly.

Command line:
exiftool "-FileModifyDate<DateTimeOriginal" "-modifydate<DateTimeOriginal" "\\nas02\photo\pictures\1920"

This command was supplied by someone else but was successful on several test subjects from later years.

Sample Result:

Source Data:
---- EXIF ----
Date/Time Original               1920:06:30 00:00:01

Target
---- File ----
File Name                        Great Uncle Harry 1.jpg
Directory                        //nas02/photo/Pictures/1920
File Size                        390 kB
File Modification Date/Time      2020:06:30 00:00:01+01:00

I hope I have provided you with enough information.

Kind Regards

Paul Barrett (newbie)


Phil Harvey

Hi Paul,

ExifTool uses the standard C library functions for date/time which are typically limited to the range 1970 to 2034.

Also, you are trying to set a filesystem date/time, and some filesystems have similar limitations.  So even if ExifTool did its own date calculations, you may still be out of luck depending on what filesystem you are using.

- 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 ($).

StarGeek

This actually isn't an error with exiftool, it's has to do with the underlying OS.  You're trying to set the file modify date to a time when there wasn't even computers.  Basically, you can't set any of the FILE timestamps to dates before 1970, because most (all?) computer time is based upon Unix time, which starts January 1st, 1970.  If you try to set the timestamp to a time before that, you have an integer underflow, basically trying to set it to a negative number and since timestamps are unsigned, you end up with a future date.

Here's a video that can help explain it:
Why 1/1/1970 Bricks Your iPhone

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Paul Barrett

#3
Thank you guys, especially for the rapid response, and I get what you are saying.  To sort out the problem is there a way I can assign a specific date from a text string so I can at least get us back from the future?  ;D

I am a complete newbie on exif tool though it looks fabulous

- Paul

PS From what you said about 2034 being the date limit, I guess that explains these error messages with their 2040 date :)

Warning: Cannot handle date (01, 00, 00, 30, 5, 2040) in File:FileModifyDate (ValueConvInv) - //nas02/photo/pictures/1940/Great Uncle Harry 2.jpg
Warning: Cannot handle date (01, 00, 00, 30, 5, 2040) in File:FileModifyDate (ValueConvInv) - //nas02/photo/pictures/1940/Grandma Beatrice Barrett.jpg

Phil Harvey

You can write a specific date like this:

exiftool -filemodifydate="2016:09:27 17:55:00" FILE

- 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 ($).

Paul Barrett

>You can write a specific date like this:

>exiftool -filemodifydate="2016:09:27 17:55:00" FILE

>- Phil

Hi Phil

Great - can I substitute FILE with DIR to run it over all images in a folder?

- Paul

StarGeek

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Paul Barrett

Excellent

And if it's possible, how do I make the DIR string apply to a folder and all its subfolders please?

Regards

Paul

PS This a great forum - so responsive

Hayo Baan

Hayo Baan – Photography
Web: www.hayobaan.nl

Paul Barrett


Paul Barrett

Next question.  Is there a way to tell exif tool not to update the file modified date when executing other metadata actions please?

- Paul

Phil Harvey

Hi Paul,

This is the -P option.  The application documentation explains all this and more...

- 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 ($).

Paul Barrett

Thanks Phil

Don't know why I hadn't found that doc in my searching. Must've had a senior moment  :-[

- Paul

Phil Harvey

Hi Paul,

You can also see the same documentation by running exiftool with no arguments.  The link I gave you above is just an HTML translation of this built-in documentation.

- 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 ($).

Paul Barrett

Thank you

Pointing me at the manual is a bit of a double-edged sword because it just encourages me to do other things and then screw up some more!  ;D

For example, as expected after all the updates I have been doing, I now have a large number of JPG_ORIGINAL files, which I wanted to tidy up.

I started small, on just one file and tried this:

exiftool -delete_original \\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg

As I had not used the ! parameter I expected to get a prompt before deletion.  Instead the command returned this:

    1 image files found
    0 original files found

But I can see the file in Explorer.  I tried running the command on the parent folder with the -r switch in case I had specified the file name incorrectly.  I got exactly the same answer, despite the fact that there are 4 sub folders and 271 files.

It's probably rookie error as usual.  I have stared at this till my eyes have gone square but I cannot see where I have screwed up.

Help please!

- Paul

Phil Harvey

Hi Paul,

Quote from: Paul Barrett on September 28, 2016, 10:27:26 AM
exiftool -delete_original \\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg

That command should work provided the following file exists:

\\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg_original

What does this command give?:

dir \\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg_original

- 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 ($).

Paul Barrett

It gives:

C:\Windows\ExifTool>dir \\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg_original
The system cannot find the file specified.

But that's just not right.  I can see the file in Explorer.  In fact I can see all 4,672 jpg_original files

Hm.  I think a PC reboot may be required since the command line won't even let me switch to the mapped drive y: - perhaps that's the cause of the issue.  I will reboot and let you know...

- Paul

Phil Harvey

Could the problem be the leading double backslashes?  I'm not familiar with that syntax.

Maybe something like this would work?:

dir y:\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg_original

And if so, the exiftool command should be:

exiftool -delete_original y:\nas02\photo\pictures\2000-04\2000-04-01_0001.jpg

or this to delete them all:

exiftool -delete_original -r y:\nas02\photo\pictures\

but you should be sure your updates are good, or have backups before deleting all of the originals.

- 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 ($).

Paul Barrett

\\ is the UNC pathname prefix for networked drives

OK so the problem is some sort of permissions issue.  When I ran cmd as admin I could not switch to network drives.  I started a normal cmd session and, with my regular user credentials, I was able to switch to the y: drive and to the specific directory where the files are located.  There I did a dir listing and there's the file

Directory of Y:\Pictures\2000\2000-04
24/09/2016  15:24         1,726,555 2000-04-01_0001.jpg_original


I am flummoxed.  All the permutations of the delete originals command are failing, regardless of whether I run cmd as admin or not, yet all the commands that created them in the first place worked flawlessly.

Is there any reason why I should not just delete them in explorer?

- Paul

Phil Harvey

Hi Paul,

Just go ahead and delete them in Explorer then.

I can't explain or reproduce the problem you are seeing.

- 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 ($).

Paul Barrett

OK - let's just put this one in the NFI bucket

I will delete them in explorer.  I have backups with history running on these folders so I will have a fallback for 6 months.

Thanks for your help!

- Paul

StarGeek

When you have your command setup how you like it, you can add -overwrite_original to the command to skip the creation of the "_original" backup files.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype