Linux: set filedate earlier then 1965

Started by asp, June 03, 2014, 11:14:19 AM

Previous topic - Next topic

asp

I have some old scanned images with Original dates early in the last century. I am trying to set the file system date to be the same as the original image date.

$ exiftool '-filemodifydate<DateTimeOriginal' -overwrite_original *.jpg

This works for back to 1965, but not earlier.

$ exiftool -args 1915\(aprx\)aaltjebosma.jpg | grep Original
-DateTimeOriginal=1915:05:05 11:40:00

$ ls -lt 1915\(aprx\)aaltjebosma.jpg
-rw-r--r-- 1 asp asp 918170 May  5  2015 1915(aprx)aaltjebosma.jpg

As you can see, the filedate got set to the year 2015 instead of 1915 in this case.

I can manually set the filedate to 1915 using the touch command:

$ touch -t 191505051140 1915\(aprox\)janpater.jpg

$ ls -lt 1915\(aprox\)janpater.jpg
-rw-r--r-- 1 asp asp 978527 Apr  5  1915 1915(aprox)janpater.jpg

Is there some way to get exiftool to write the earlier filedate?

Phil Harvey

Quote from: asp on June 03, 2014, 11:14:19 AM
$ exiftool '-filemodifydate<DateTimeOriginal' -overwrite_original *.jpg

This works for back to 1965, but not earlier.

Interesting.  This is very system dependent.  On many systems you would be limited to 1970 or later.

Quote$ exiftool -args 1915\(aprx\)aaltjebosma.jpg | grep Original
-DateTimeOriginal=1915:05:05 11:40:00

$ ls -lt 1915\(aprx\)aaltjebosma.jpg
-rw-r--r-- 1 asp asp 918170 May  5  2015 1915(aprx)aaltjebosma.jpg

As you can see, the filedate got set to the year 2015 instead of 1915 in this case.

Cool.

Unfortunately I rely on standard library date/time routines for this.  These libraries have certain limitations.  I have checked, and the behaviour is the same for me on OS X when I try to set a year to 1915.  The problem is the Time::Local::timelocal() function.  I can't see any work-around short of re-writing the standard library routines (which I may do some day because these limitations bug me).

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

asp

Did I forgot to mention that I am running on Ubuntu 14.04?

At the moment, I have only ~30 pre 1965 files. For the time being, I'll just "touch -t" them. Does that work on OS X as well?




Phil Harvey

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