Antarctica

Antarctica
by ʇolɐǝz ǝɥʇ qoq

Submit your Photo
Hall of Fame

Please participate in Meta
and help us grow.

Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know of such a thing?

I want to specify a directory and have the software find all the photos in the directory and its sub-directories, and if they contain EXIF date/time, it sets their filesystem timestamp to match the EXIF.

share|improve this question

This is the inverse of Is there any software which will set the EXIF Dates based on the file's modification date?, and I'm sure all of the programs listed there will apply.

jhead

Of these, for this very simple task, jhead is my suggestion. For example, the command

jhead -ft *.jpg

sets a bunch of files so that the file timestamp matches EXIF.

jhead with find, for going through subdirectories

In order to perform recursion into subdirectories, you could to combine it with the find command available on Linux/Unix/Mac (or Cygwin for Windows):

find -name '*.jpg' -exec jhead -ft {} +

Or to find any of *.JPG *.JPEG *.jpg *.jpeg ... you can also try

find -iname '*.jp*g' -exec jhead -ft {} +

You can also use find to just show all the files that would be... found, without executing any other command (like jhead):

find -iname '*.jp*g'

Other Tools

Other utilities like ExifTool or Exiv2 are much more capable, but at the price of complexity. I can never remember offhand the right options to do anything with those and have to look at the documentation every time, but jhead -ft is easy to remember with the mnemonic "fix time".

ExifTool

Just for completeness, though, I did look at the documentation, and with ExifTool, do this:

exiftool -r '-DateTimeOriginal>FileModifyDate' directoryname

(Remove the -r if you don't want recursion, and if you do that, you can also give a list of files or a wildcard instead of directoryname.) And be careful with those quotes — if you're running this on Windows, you want " instead of '.

Exiv2

With Exiv2:

exiv2 rename -T *.jpg

Beware that with lowercase -t (or without any -T) Exiv2 will also rename the file to a new name based on the timestamp, which may be very confusing. Exiv2 also does not do recursion.

share|improve this answer
1  
You are right, this is the opposite but infinitely more useful :) – Itai Sep 14 '12 at 17:11
    
jhead is very useful for this - AND for many other jpg file manipulations. Be careful when using it - it is an extremely powerful tool that can wreak a certain amount of havoc if misused. I recommend using it in a batch file so you always do what you intend, and testing the result on a test file set first. – Russell McMahon Sep 14 '12 at 23:23
    
+1 but I awarded myself the answer ;-) Just so others in future can find a way to do exactly what I asked ... – Mawg Sep 19 '12 at 4:39
    
@olibre Yes, that will work on Linux/Unix or Mac. – mattdm Jan 18 at 0:35
    
I have noticed some picture browsers present (diaporama) pictures only on filename order (not on file modification time). Finally I use the EXIF timestamp to set the file time AND to prefix the file name. I use command find -name '[0-9][0-9]*' -o -iname '*.jp*g' -type f -exec jhead -ft -n%Y%m%d_%H%M%S_%f {} +. Explanations: -name '[0-9][0-9]*' to prevent renaming again files already having a date prefix ('[0-9][0-9] to take into account years and months). -iname '*.jp*g' can be skipped because jhead only processes supported files (only JPEG files). %f to keep original filename. – olibre Jan 18 at 23:28

Irfanview and jhead will both do what you want.
Both free.
Links to both below.
jhead is command line driven or can be called by other processes.
Irfanview version can be invoked from a command line or internally in a batch or on a file by file basis.

Example below for Irfanview shows how to copy in either direction:


Irfanview allows command line or batch or per file date/time transfer from EXIF to file spec or vice versa (with no other file changes if so desired).

Source: Free from www.irfanview.com

Batch "save with original date/time".
This will set file date and time to camera EXIF values.

  • File / batch / Add all.
    Advanced / Save files with original date/time

From command line - this is a "rotate" with NO action except to copy date/time from EXIF to file date and time. The opposite can also be achieved if desired. :

  • i_view32.exe file_spec\*.jpg /jpg_rotate=(0,0,0,1,0,0,0,0)

To copy date/time in opposite direction ((filespec to EXIF) use as above with (0,0,1,0,0,0,0,0)


jhead will do just about anything you can imagine with jpeg files

Source: Free from http://www.sentex.net/~mwandel/jhead/

I use a batch file as below. Other options are possible:

  • jhead -ft %1.jpg

They say: Things jhead can modify in an exif jpeg file

  • Up-right images according to rotation tag using jpegtran
    Set or relative adjust internal exif timestamps
    Fix date / time offsets in large batches of images
    Re-name or date stamp files according to exif timestamp
    Transfer exif headers between images
    Replace thumbnails inside Exif headers
    Edit jpeg comments (but not the Exif comments)
    Delete exif or comment sections from jpeg images
    Create new minimal exif header containing date and thumbnail
share|improve this answer

Just another command line EXIF tool that can do change the last modified date of files to match the time of taking the picture, based on the EXIF metada in the JPEG image file:

 exiv2 -T rename somedir/foo*.jpg

No worries, the command argument rename is ok there and does no harm.
It's just that the file rename action is misused to only create the side effect of changing the timestamp.

share|improve this answer

While I really don't recommend relying on the file date/time when it comes to your images you can use a free tool called EXIF Date Changer to batch set the file dates of all your JPG images. The default setting will set both the date created and date modified file dates to the photo taken taken.

The reason why I don't recommend this is the file date is easily updated. If you edit the image the date modified gets updated. If you copy the image it gets a new date.

A much better solution is to rename the files to include the date/time in the filename itself. This still allows easy sorting and works well with images stored on iPhones / dropbox.

EXIF Date Changer - Set file dates to date taken

share|improve this answer

Check out my new free software "Photo Date Organizer": http://photodateorganizer.sourceforge.net/

enter image description here

share|improve this answer
1  
From the SourceForge page: "Brought to you by: killdaclick". Advertising your own products isn't forbidden here, but you should make it clear what your affiliation is. – Philip Kendall Jul 15 '15 at 11:27
    
@PhilipKendall done :) – killdaclick Jul 16 '15 at 12:14
up vote 0 down vote accepted

I suggested it to the author of PhotoRenamer, who replied ...

PhotoRenamer 3.2 http://www.tgmdev.be/applications/photorenamer/photorenamer.php

I add a button in the ‘Options’ tab of the Ribbon .. From there, you can select the option for updating the file time status of the file ..

By the way, to avoid the use of mask, I also add a new mask attribute: %F. If you use this simple mask, the file is renamed ... with it’s own name ... So you are not obliged to rename the file for which you want to update the file time attributes ...

share|improve this answer

The other free program is Google Picasa - you can easyly batch change date and time for all the photos:

enter image description here

enter image description here

Nice article about it: How to Change a Photo’s Date in Picasa to When the Photo Was Taken

share|improve this answer
1  
How is this solution working ? The OP wants to change the file date to correspond to the EXIF date. That is probably not what Picasa is doing. – Olivier Jun 7 at 10:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.