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.

10 Answers 10

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 -T rename *.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.

  • 2
    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 '16 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 '16 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 GUI or command line changes of 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

This is MUCH easier and quicker in practice after just a few uses than the instructions below make it appear. eg
To convert a single file's date/time to EXIF values requires
Shift-J, Alt-F, Enter.
Seeing why the 1st few times takes longer.

To do this for a batch of files SOUNDS complex to learn -
It requires: T, Ctrl-A, Alt-F, J, Enter, (Alt-F), Enter
(Or: T, Ctrl-A, Shift-J, Enter)(gives fewer options)
BUT in fact it is almost wholly intuitive after a little use - menus guide you initially until brain path forms.

GUI, per file

  Options, JPG lossless rotation  (Shift-J)
    Select "Apply original EXIF date/time to new file"
        Consider also selecting other options

enter image description here

GUI, one or many files (via Thumbnail view)

Open Thumbnails view ('File, Thumbnails' or 'T' from Window view
Select images to change EXIF data of 
    usually all in folder -> Ctrl-A
Then: File, 'JPG lossless operations'
    (1) Change EXIF date/time
      "Change EXIF date/time"
        Options are offered to set Date/time to specific setting
        or to move all times back/forwards by selected DHMS amount 
              calculator provided to check result is as desired.                 
     (2) Transfer EXIF date / time to file saved date time
          "Lossless rotation with selected files"  [Shift-J]
          then, as for single file version above
              Select "Apply original EXIF date/time to new file"

enter image description here

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

_________________________

Note: August 2016: "Anonymous user" correctly suggested that one suggested conversion did not work as I said. I've extensively added to the area concerned.

  • August 2016: "Anonymous user" correctly suggested that one suggested conversion did not work as I said. I've extensively added to the area concerned. – Russell McMahon Aug 27 '16 at 0:55
  • What about raw files? – Michael Clark Dec 15 '17 at 9:39
  • @MichaelClark I'm glad you asked that question :-). I note that we all seem to have addressed JPG files and not RAW. I'd imagine that you would be one of the more likely people to ask re how to do this with RAW files :-). – Russell McMahon Dec 15 '17 at 11:58

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.

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

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

enter image description here

  • 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

FastStone Image Viewer can do this (version 4.9 used) - just select the files in thumbnail pane, right click them, select "Tools" > "Change Timestamp" - then you can either use EXIF (with or without modifications) data or use wholy custom fixed manual date/time.

  • Wow! I did ,not know that.I have been using their screen capture tool for years and have not found anything better . You cna get the last free version here; I on't need any of the for pay features. I have also used their viewer in the past, but did not know that it could do that. – Mawg Aug 4 '17 at 9:53

Advance Renamer is the best user friendly software which is very simple.

  1. Drag and drop all the photos to AR(Advance Renamer)

  2. Click on (Top left) Add Method -> New Name

  3. Click on one of the image bottom middle you'll see a button ExifTool which shows all metadata just click on an attribute and you'll get the tag In this case it is <ExifTool:DateTimeOriginal>

  4. Copy this and paste in the New Name textbox You can add anything before or after like IMG_<ExifTool:DateTimeOriginal> , DSC_<ExifTool:DateTimeOriginal> etc.

  5. Click Start batch (Top Right) This will rename all your files with the date E.g. 2017_12_01 19_10_12 It's always good to have the original date in the file name cause attributes may be lost but file names won't.

  6. Again drag all renamed files on to AR
  7. Click New method -> Timestamp
  8. Check All 3 checkboxes Create, Modify, Accessed(Accessed sometimes may not work just uncheck it if it happens)
  9. Select FileName Pattern and paste <Year>_<Month>_<Day> <Hour>_<Min>_<Sec>
  10. Start Batch.
  11. You're good. Mission Accomplished
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 ...

This is an old question and it looks like there are a few suggestions that should work well, but the one I arrived at to sort a file ordering issue after an Android phone upgrade was this.

  • Crank open Windows (for the first time in ages)
  • Install ExtFS or something that can read ext4 partitions
  • Copy photos to hard disk from Micro SD
  • Use Attribute Changer (https://www.petges.lu/home/) to set created/modified dates to the EXIF date
  • Whack card back in phone
  • Copy photos back to phone over MTP

Maybe this will be useful to someone.

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

  • 2
    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 '16 at 10:17

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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