* READONLY * FileCreateDate ?

Started by HiTechHiTouch, August 05, 2012, 11:19:02 AM

Previous topic - Next topic

HiTechHiTouch

I've discovered all the problems setting the file system file creation date, and this isn't about doing that.

This is going the other way, i.e. setting a tag to information obtained from the file system.

For example, I need exif's created for some files and populated.

  -ExifTool -Exif:DateTimeOriginal<FileCreateDate -Exif:ImageDescription<FileName . . .

Is the file system create date available to generic Perl?

Thanks!

Thanks!

Phil Harvey

No, sorry.  Unix file systems (UFS) do not store the file creation date, and as a result there is no standard Perl routine to read/write this.

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

merrickw

Hi Phil,

I just started using your ExifTool and it's hard to believe how many formats you cover. 
But, as Murphy's law would have it, the final bit I need is not there.  All I'm trying to do is set all dates = to the original date taken, but I need the Windows FileCreateDate to be included in that.  Is there any chance this can be accomplished?

I was using a tool called AttibuteMagic Pro which can set all the dates from the Original Date Taken, but it only works on .jpg.  I need jpg mp4 and mov, which you've got covered.

Thanks again for a terrific tool.

Regards,
Merrick

Phil Harvey

#3
Hi Merrick,

The file creation date can not be set through the standard Perl library, which is why ExifTool can't yet write this.  I may be able to read this value for some filesystems using standard Perl calls, but I haven't looked into this in detail.  I didn't think there was much point to adding it read-only, but maybe there is since it would be useful to you.  I'll look into this.

- Phil

Edit:  Readonly.  Right.  How did I miss that?
...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 ($).

Phil Harvey

I did some tests and the inode change time (readable, but not writable, by standard library functions) in Windows is the file creation date.  I will add the ability to read this in Windows to ExifTool 9.07.  This will not work for Mac or Linux.

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

merrickw

Hi - I actually need to be able to set FileCreateDate to DateTimeOriginal (or CreateDate for movie files). 

My goal is to have all dates associated with the jpg/mp4/mov set to one single date, the DateTimeOriginal.  That way my other cataloging programs won't get confused on how to sort these files.

Thanks for looking into this.

Regards,
Merrick

PS - as a side question, if I use "-filemodifydate<createdate", what happens if there are multiple CreateDates?  ie, my MOV has:
[EXIF:ExifIFD]  CreateDate                      : 2012:10:07 14:40:14
[QuickTime]     CreateDate                      : 2012:10:07 18:40:14


Phil Harvey

Quote from: merrickw on November 20, 2012, 09:51:05 AM
Hi - I actually need to be able to set FileCreateDate to DateTimeOriginal (or CreateDate for movie files). 

OK.  Making this writable can certainly not be accomplished with the standard libarary.  But I'll see what I can do.

QuotePS - as a side question, if I use "-filemodifydate<createdate", what happens if there are multiple CreateDates?  ie, my MOV has:
[EXIF:ExifIFD]  CreateDate                      : 2012:10:07 14:40:14
[QuickTime]     CreateDate                      : 2012:10:07 18:40:14

It will use the date/time you see without the -a option.

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

merrickw

I see.  It turns out the [QuickTime] CreateDate survives in my case.


Phil Harvey

I've found a module I can use that works for reading and writing the filesystem creation date in Windows, and will add this in ExifTool 9.07.  I've looked for a similar solution for the Mac, but haven't found anything yet.  There was a module that did this for older OS X versions, but I tried it and it doesn't work for the current OS X.

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

merrickw

Excellent - thank's so much.  I don't know why anyone would use a Mac anyway.

merrickw

Hi - so I downloaded 9.07, but I can't figure out what tag to use to read/write FileCreateDate.  I was using -time:all to read but I don't see the new field in that shortcut.

Also - I've been using:
exiftool "-filemodifydate<datetimeoriginal"

and that was setting both the modify and access date.  I was hoping there would be one command to set all three from datetimeoriginal.

Phil Harvey

What tags to you see with exiftool -a -G1 -s -time:all 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 ($).

merrickw

[System]        FileModifyDate                  : 2012:11:25 18:05:32-05:00
[System]        FileAccessDate                  : 2012:11:25 18:05:32-05:00
[IFD0]          ModifyDate                      : 2012:11:23 14:30:19
[ExifIFD]       DateTimeOriginal                : 2012:11:23 14:30:19
[ExifIFD]       CreateDate                      : 2012:11:23 14:30:19


I was hoping to see a [System] FileCreateDate ...

Phil Harvey

This is unfortunate.  I'm assuming that you're running Windows 7?  I tested this on 2 Windows XP systems and it worked.  It would be unfortunate if it doesn't work on Windows 7.  I'll see if I can test this.  If this isn't portable across different Windows versions I may just have to retract this feature. :(

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

merrickw

#14
Windows XP.  I can test in Win 7 as well.

Update:  Same result from Win7 as I got from WinXP

Update2: I'm an idiot.  When I extracted the new version of exiftool, I forgot that I also copied the exe to remove the -k.  So I was running the old version.

Now I get all 6 dates:

======== G:/My Documents/My Pictures/2011-10-07/temp/IMG_3531.JPG
[System]        FileModifyDate                  : 2012:11:25 18:05:32-05:00
[System]        FileAccessDate                  : 2012:11:25 18:05:32-05:00
[System]        FileCreateDate                  : 2012:11:25 18:05:32-05:00
[IFD0]          ModifyDate                      : 2012:11:23 14:30:19
[ExifIFD]       DateTimeOriginal                : 2012:11:23 14:30:19
[ExifIFD]       CreateDate                      : 2012:11:23 14:30:19

Is there one command to modify all three system dates at once? 
ie (allsystemdates)<DateTimeOriginal ?

Thanks again.

Update3: Win7 gives same results.

Phil Harvey

Great.  I was thinking that I should have added -exiftoolversion to the command to verify you were running the correct version.

I just tried this on Windows 7 too, and it worked for me. (whew!)

There is no shortcut for the system dates.  You must write them with separate arguments (but you can do this in a single command).  Or you could create a user-defined shortcut.  Note that FileAccessDate is not writable.

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

merrickw

Quote from: Phil Harvey on November 26, 2012, 08:42:27 AM
Note that FileAccessDate is not writable.


I think it is writeable ... I was able to go from:

======== G:/My Documents/My Pictures/2011-10-07 /temp/WP_000549.jpg
[File:System]   FileModifyDate                  : 2012:11:18 19:39:10-05:00
[File:System]   FileAccessDate                  : 2012:11:18 19:53:44-05:00
[EXIF:IFD0]     ModifyDate                      : 2012:11:07 13:13:53
[EXIF:ExifIFD]  DateTimeOriginal                : 2012:11:07 13:13:53
[EXIF:ExifIFD]  CreateDate                      : 2012:11:07 13:13:53


to:

======== G:/My Documents/My Pictures/2011-10-07/temp/WP_000549.jpg
[File:System]   FileModifyDate                  : 2012:11:07 13:13:53-05:00
[File:System]   FileAccessDate                  : 2012:11:07 13:13:53-05:00
[EXIF:IFD0]     ModifyDate                      : 2012:11:07 13:13:53
[EXIF:ExifIFD]  DateTimeOriginal                : 2012:11:07 13:13:53
[EXIF:ExifIFD]  CreateDate                      : 2012:11:07 13:13:53


using only:

exiftool "-filemodifydate<datetimeoriginal"

so ... is that a 'bug' or a 'feature'?

Update: this occurred with version 9.06; 
the same command in 9.07 gives me 0 image files updated.  What happened?  I used to get 2 out of 3 ...


Phil Harvey

OK.  You got me.  But try reading the date/times again and see what happens.

ExifTool does actually write the FileAccessDate when writing the FileModifyDate, but the FileAccessDate should get reset to the current date/time whenever the file is accessed.  So if you read it again it should be the time that you last read the file.  This should be the same for ExifTool 9.06 or 9.07.  However, if you use 9.07 to also write FileCreateDate in the same command, I'm not quite sure what will happen to FileAccessDate.

If you get "0 image files updated" it is likely that the file didn't contain a DateTimeOriginal.

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

merrickw

The files are the same from the 9.06 test vs 9.07; 
DateTimeOriginal is there:

======== G:/My Documents/My Pictures/2011-10-07/temp/IMG_3531.JPG
[File:System]   FileModifyDate                  : 2012:11:25 18:05:32-05:00
[File:System]   FileAccessDate                  : 2012:11:25 18:05:32-05:00
[File:System]   FileCreateDate                  : 2012:11:25 18:05:32-05:00
[EXIF:IFD0]     ModifyDate                      : 2012:11:23 14:30:19
[EXIF:ExifIFD]  DateTimeOriginal                : 2012:11:23 14:30:19
[EXIF:ExifIFD]  CreateDate                      : 2012:11:23 14:30:19

Only 9.07 gives me 0 images updated,
somehow "-filemodifydate<datetimeoriginal" stopped working. 
I don't want to try the new "-filecreatedate<datetimeoriginal" until I understand what happened to that.

Phil Harvey

#19
You're right.  It seems that I broke this somehow in 9.07.  I'll post back when I know more.

- Phil

Edit:  Yup.  Darnit.  I broke the writing of FileModifyDate in 9.07.  I'll release 9.08 a.s.a.p. to fix this. (Probably tomorrow morning.)
...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 ($).

Phil Harvey

ExifTool 9.08 is now available, and should fix the problem of writing FileModifyDate.

Sorry for the inconvenience, and thanks for pointing out this problem.

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

merrickw

Hey, no problem at all!  Thanks for adding the feature.  I was looking for a tool to grab the createdate from my jpgs, mp4s and movs and set the three system dates at once, and now I have it.  Thanks so much for a terrific tool!

Regards.
Merrick

merrickw

Hi - before I leave this topic to rest, I had two more questions:

1 - I see that FileAccessDate gets set the same as FileModifiedDate, when I use -filemodifydate<datetimeoriginal.  Is this a side-effect?  And is this a side-effect I can count on, or should I add an explicit: -fileaccessdate<datetimeoriginal as well?

2 - Time zones - I don't really understand what's happening but it looks like the EXIF dates have no time zone, but once I set the filemodifydate, it's getting a-05:00 appended.  Is that also a side effect? 
(And some of my files have -04:00 appended, perhaps from another program)
Any light on this topic would be great.

Thanks again,
Merrick

Phil Harvey

Hi Merrick,

Quote from: merrickw on November 27, 2012, 12:41:06 PM
1 - I see that FileAccessDate gets set the same as FileModifiedDate, when I use -filemodifydate<datetimeoriginal.  Is this a side-effect?

As I mentioned earlier in this thread, FileAccessDate gets updated to the current date/time whenever the file is accessed.  I haven't made FileAccessDate directly writable for this reason (limited usefulness), however it does get set when writing FileModifyDate.

Quote2 - Time zones - I don't really understand what's happening but it looks like the EXIF dates have no time zone

Correct.

Quotebut once I set the filemodifydate, it's getting a-05:00 appended.

This is not an EXIF tag.  It is information stored in the filesystem, and as such the system timezone applies.

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

merrickw

#24
ok - thanks for the answers.

The only point I would make is my experience shows that the fileaccessdate is not getting the current datetime, but the same as filemodifydate; (which is what I would want).

ie, all system dates end up matching DateTimeOriginal:

======== G:/My Documents/My Pictures/2011-10-07/temp/IMG_3531.JPG
[File:System]   FileModifyDate                  : 2012:11:23 14:30:19-05:00
[File:System]   FileAccessDate                  : 2012:11:23 14:30:19-05:00
[File:System]   FileCreateDate                  : 2012:11:23 14:30:19-05:00
[EXIF:IFD0]     ModifyDate                      : 2012:11:23 14:30:19
[EXIF:ExifIFD]  DateTimeOriginal                : 2012:11:23 14:30:19
[EXIF:ExifIFD]  CreateDate                      : 2012:11:23 14:30:19

Phil Harvey

Right, I agreed with you when you first stated this.  Yes, I write both FileAccessDate and FileModifyDate with the same value when you write FileModifyDate.

But now try reading the file again.  FileAccessDate will have changed.

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

merrickw

Do you mean when I try reading the file with exiftool?  Because when I do FileAccess stays fixed to the DateTimeOriginal.  I get the same results immediately after setting the modifydate and also several minutes later:


======== G:/My Documents/My Pictures/2011-10-07/temp/IMG_3531.JPG
[File:System]   FileModifyDate                  : 2012:11:23 14:30:19-05:00
[File:System]   FileAccessDate                  : 2012:11:23 14:30:19-05:00
[File:System]   FileCreateDate                  : 2012:11:23 14:30:19-05:00
[EXIF:IFD0]     ModifyDate                      : 2012:11:23 14:30:19
[EXIF:ExifIFD]  DateTimeOriginal                : 2012:11:23 14:30:19
[EXIF:ExifIFD]  CreateDate                      : 2012:11:23 14:30:19

Phil Harvey

You're really going to make me drag out the PC and try this myself on Windows, aren't you?  Grrr...

C:\Documents and Settings\Phil\Desktop>exiftool -ver
9.08

C:\Documents and Settings\Phil\Desktop>exiftool a.xmp -artist=me
    1 image files created

C:\Documents and Settings\Phil\Desktop>exiftool a.xmp -system:time:all
File Modification Date/Time     : 2012:11:28 07:21:27-05:00
File Access Date/Time           : 2012:11:28 07:21:27-05:00
File Creation Date/Time         : 2012:11:28 07:21:27-05:00

C:\Documents and Settings\Phil\Desktop>exiftool a.xmp -filemodifydate="2012:10:01 10:30:45"
    1 image files updated

C:\Documents and Settings\Phil\Desktop>exiftool a.xmp -system:time:all
File Modification Date/Time     : 2012:10:01 10:30:45-04:00
File Access Date/Time           : 2012:10:01 10:30:45-04:00
File Creation Date/Time         : 2012:11:28 07:21:27-05:00

C:\Documents and Settings\Phil\Desktop>exiftool a.xmp -system:time:all
File Modification Date/Time     : 2012:10:01 10:30:45-04:00
File Access Date/Time           : 2012:11:28 07:22:22-05:00
File Creation Date/Time         : 2012:11:28 07:21:27-05:00


Just as I said.

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

merrickw

Well, I can't argue with that .... but .... I do get different results on my XP machine; 
Plus, I replicated your test on a Win7 machine, and same thing:


C:\exiftool>exiftool -ver
9.08

C:\exiftool>exiftool a.xmp -artist=me
    1 image files created

C:\exiftool>exiftool a.xmp -system:time:all
File Modification Date/Time     : 2012:11:28 08:17:25-05:00
File Access Date/Time           : 2012:11:28 08:17:25-05:00
File Creation Date/Time         : 2012:11:28 08:17:25-05:00

C:\exiftool>exiftool a.xmp -filemodifydate="2012:10:01 10:30:45"
    1 image files updated

C:\exiftool>exiftool a.xmp -system:time:all
File Modification Date/Time     : 2012:10:01 10:30:45-04:00
File Access Date/Time           : 2012:10:01 10:30:45-04:00
File Creation Date/Time         : 2012:11:28 08:17:25-05:00

C:\exiftool>exiftool a.xmp -system:time:all
File Modification Date/Time     : 2012:10:01 10:30:45-04:00
File Access Date/Time           : 2012:10:01 10:30:45-04:00
File Creation Date/Time         : 2012:11:28 08:17:25-05:00

C:\exiftool>


My access time is not changing - I subsequently checked several times and it stays the same as the modify date.
Maybe there is an OS bug somewhere, but it's working for me, so I don't want to waste any more of your time.

By the way, why is the tool using a timezone of -04:00 when the system uses -05:00?

Phil Harvey

The posix specification states that the file access time should be updated to the current time whenever the file's data is accessed.  Operating systems may or may not conform to this standard.  In this case I wouldn't worry too much if they don't, but I must admit that I am surprised you get a different result on the same system (I was running XP), but ExifTool has nothing to do this this.

The -04:00 / -05:00 timezone difference is due to a change in daylight savings time that occurred on November 4.  Dates before Nov. 4 are -04:00 and dates after Nov. 4 are -05:00.

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

merrickw

Thanks again for adding the FileCreateDate and answering my timezone questions.  I wanted all the system dates to match the created dates to avoid any program confusion, and now they look clean. 

Regards,
Merrick