ExifTool Forum

General => Metadata => Topic started by: asp on June 03, 2014, 11:14:19 AM

Title: Linux: set filedate earlier then 1965
Post by: asp on June 03, 2014, 11:14:19 AM
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?
Title: Re: Linux: set filedate earlier then 1965
Post by: Phil Harvey on June 03, 2014, 12:49:16 PM
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
Title: Re: Linux: set filedate earlier then 1965
Post by: asp on June 03, 2014, 01:32:09 PM
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?



Title: Re: Linux: set filedate earlier then 1965
Post by: Phil Harvey on June 03, 2014, 02:08:18 PM
Yes, the touch worked on OS X.

- Phil