Can exiftool change the timestamp of a file on Mac or Linux Operating System?

Started by richimages, December 14, 2012, 02:39:01 PM

Previous topic - Next topic

richimages

I am wanting to use exiftool for lots of things ...   

But to get started, (I am switching from a windows PC to a mac system ) I would like to use exiftool to  recursively go through a root photo directory,(  say /PhotoTreeDirectory ),  and copy all these photos into a single folder, ( say /NewPhotoDir), and, I'd like to have the copied files get file creation operating system timestamps matching their EXIF creation time tags.   Is that possible from an exiftool command on a linux or mac OS?   Or do I need to write some code to do this?

Thanks,

Richard

BTW ... The exiftool is INCREDIBLE ...  I've never seen such powerful execution come from a command line tool before ...    Thanks Much Phil ....



Phil Harvey

Hi Richard,

As far as I know, Linux filesystems don't store a file creation date.  (Which should be the same for UFS filesystems on the Mac.)

Mac OS extended filesystems do store a file creation date, but I haven't found a reliable way to access this from Perl (there is a MacOSX::File module, but it doesn't seem to be portable across different OS X versions, and most importantly doesn't seem to work on recent ones).

So the answer is no.  ExifTool can not write the FileCreateDate on Mac or Linux.  It can, however, write FileModifyDate on all systems.

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

mistaknly

I figured it out from the forum (this dummy had it backwards.... :-[ )

exiftool "-FileModifyDate<DateTimeOriginal"  FILE

did what I wanted below.   :)



"It can, however, write FileModifyDate on all systems."


I have many avi files that have 8/17/2010 as the modification Date, etc. For example:

C:\XIFF>exiftool -h mvi_0229.avi
<!-- mvi_0229.avi -->
<tr><td>File Modification Date/Time</td><td>2010:08:17 15:53:47-07:00</td></tr>
<tr><td>Date/Time Original</td><td>2009:06:11 17:02:31</td></tr>


EDIT: (learned a new one...)

C:\XIFF>exiftool -s -time:all *.avi
FileModifyDate                  : 2010:08:17 15:53:47-07:00
FileAccessDate                  : 2012:12:14 10:29:14-08:00
FileCreateDate                  : 2012:12:14 10:29:14-08:00
DateTimeOriginal                : 2009:06:11 17:02:31



I would like to change the File Modification Date/Time from 8/17/2010 to
the Date/Time Original that exist in the files.

exiftool "-DateTimeOriginal<FileModifyDate" FILE didin't work since
it said writing "to" avi files isn't supported.  But I'm not writing to
the file, I'm just modifying the date. 

Which part of the documentation do I read to learn how to do this.
I keep reading how to change the exif data which is not what I want
to do so I'm a little lost.  I also have many jpg image files that are in the
same boat.

Thanks.

PS. Terrific tool!

richimages


Hi Phil,

This worked on my mac, (OS 8.3 Mountain Lion) ...  and linux redhat, (have not tried it on Windows 7 ... )

Ironically, this python code relies on your exiftool ( although the user seems to call it simply "exif" ) ... Oh, yeah, and it seems to require python version 2.6  ( I verified it will not work with version 3 or 2.4).

You may already know about this ... but just incase you do not: 


http://koblik.blogspot.com/2009/06/exif-with-python.html
     -or-  (same code)
http://code.activestate.com/recipes/576822-redate-pictures-with-exif/

Phil Harvey

Hi Richard,

I'm glad you found a solution that works for you.  Although I don't understand how you say it works on redhat, because I didn't think Linux stored a creation date.

It seems that Python has the same problems as Perl when it comes to FileCreateDate.  Libraries that are version dependent are a real pain.

I took a quick look at the "exif" library.  I don't think it relies on ExifTool.  It seems to be just a very simple EXIF parser, written in C.

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