TransWikia.com

Is there a free program to (batch) change photo file's date to match EXIF?

Photography Asked on April 24, 2021

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.

14 Answers

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.

Correct answer by mattdm on April 24, 2021

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 ...

Answered by Mawg says reinstate Monica on April 24, 2021

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)

WARNING: (Added 2020!)
It's been pointed out that selecting the wrong options can get an undesired result - eg all destination files set to a single selected date and time. Doing it right is "not too hard" - but DO look at the various check boxes and decide which one suits what you wish to do.

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.

Answered by Russell McMahon on April 24, 2021

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.

Answered by Volker Siegel on April 24, 2021

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

Answered by Greg on April 24, 2021

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

enter image description here

Answered by killdaclick on April 24, 2021

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

Answered by Vladislav on April 24, 2021

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.

Answered by triff on April 24, 2021

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.

Answered by Kozuch on April 24, 2021

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

Answered by Shalem Raj on April 24, 2021

I signed up to StackExchange just so I could thank the OP for having posted this, and add my workaround bc some of the commands here didn't work for me. Sorry, I'm gonna talk about my process.

I'm in the midst of a "Let's finally clean up my photo archives" effort as the struggle is real, especially since iCloud and Google Photos take them from your device and file management has little to do with it these days (and in earlier times, good services and products were a little wayward and enforced a weird randomness and duplication that required real effort to overcome.)

I've used Flickr to get photos off my machine when my drive was too small to hold them all. I've used Google Photos on one account since 2006 so I had a set of random duplicates and unique pics up there, through its different upload incarnations.

When iPhone photography really started going, I'd connect by USB, import them to my Dropbox which would rename them with a date-time stamp ??, put them into a year/month folder with a bit of curation to sort out screenshots and shopping photos, and Google Photos watched that archive folder to upload them. This worked well until iCloud seized the photos from my iPhone and getting them proved to require its own workflow.

Because duplication has always been a BIG problem, a tool called Gemini II finally made this clean-up and archive project possible.

To consolidate my archive on an external drive, I decided to download all pics but the most recent off iCloud (using Image Capture and a USB to my phone: not 100% reliable), Flickr, and Google, and clean it all up.

That's how I discovered Exif data: some photos (only some) weren't flat files (see image below) and showed their metadata in the Finder. Most only have the Created-Modified date visible. What I downloaded from Flickr (and some from Google) saved as if they were created and modified on the day I downloaded them. Not good. Some had visible EXIF data, but many/most looked flat. I had been deleting duplicates bc they had the wrong timestamp (if they were same size or smaller, that is). Finding out about Exif data and time stamp led me here.

The Dropbox step has always been important to me because IMG_#### or DSC#### has always been useless. Someone asked me why I didn't skip the Dropbox step and use Automater to rename them. Automater doesn't have the capability that I can see, but thanks to Jhead this is finally going to work.

I figured out how to first install jhead and then run jhead through a directory recursively and more often than not, EXIF data was still in the photo files. Result: jhead changed the dates of the files to what was in the EXIF data. No disappointments.

First, for Mac users: follow the untar installation instructions from the command line (Terminal). If you don't find them for jhead, find general untar instructions and sub in the location of the jhead tarball. This worked, because downloading and trying to install from the command line certainly didn't. Next: make sure you install Xcode off the App Store. All Apple developers need this program and it makes commands work that otherwise won't. It's needed for 'make' and 'install make'.

Using the jhead tool: I'm not familiar with reading Unix instructions and manuals (man jhead) but familiar enough with CLI that if someone has documented something somewhere, I try their options until something works.

This didn't work for me:

[directory that I want]> find -name '*.jpg' -exec jhead -ft {} +

Elsewhere on StackExchange I found a different recursive-search string that I got to work for find (it had a -print option that didn't seem necessary):

 find . | grep '.*[.]jpg' 

but if I added the jhead command, I'd get an error saying it didn't understand 'grep'

Deconstructing search terms by adding and taking away search options/variables and trying to get jhead to be a part of that command didn't work until I tried an old convention:

jhead -ft ./*/*.jpg

This ran through an entire long-ish directory and it didn't spit out very many errors like "contains no EXIF timestamp" or "Error: Time '0000:00:00 00:00:00': cannot convert to Unix time"

When I looked, only a minority of downloaded-yesterday timestamps remained. So I tested this on the other 10 folders of files I had in my "duplicates" folder. Things dated 2020 reverted to 2004, 2013, 2012. I learned that if you run through the same directory twice, you don't get output a second time.

Then I used jhead to rename my files according to the timestamp convention. It worked like a charm; if the original file name contained meaning to you and you want to retain it, make sure to include this in your chosen date-stamp string:

' '%f … *.jpg

I now find it frustrating that Finder is inconsistent at displaying this info when it could. Below is an example of a file that Finder is showing complete information for (uncommon). Image of Mac OS Finder information of photo EXIF data, complete

Answered by janerette on April 24, 2021

I had complete mess with file dates in my library, but was not satisfied with any of the tools. Some support no directory recursion, some cannot modify some windows-specific timestamps, some are difficult to use.

I made a new command-line tool for single task - recursively process all files in given directory to extract EXIF date and set file date to it.

Tool is cross-platform.

Please see ExifDate2FS

Answered by Eugene V on April 24, 2021

You can use Vera to solve that. You simply type this command in the folder where you want to fix the dates:

vera timestamp

This will not only work with JPG, but raw files like ARW. Also it works for MOV video files.

Answered by davebcn87 on April 24, 2021

Thanks to the code here - https://github.com/auberginehill/get-exif-data/blob/master/Get-ExifData.ps1 - I have written my own PowerShell script. All it does is find the "Date Taken" from EXIF and sets the file's Modified Date to the same.

$objImage = New-Object -ComObject WIA.ImageFile

ForEach ($objPicture in Get-Item .*.jpg)
{
    $strName = $objPicture.Name
    $strFullName = $objPicture | select -ExpandProperty FullName

    $objImage.LoadFile($strFullName)

    If ($objImage.Properties.Exists('36867'))
    {
        # Get EXIF Taken Time
        $dtmTaken = [datetime]::parseexact($objImage.Properties.Item('36867').Value, 'yyyy:MM:dd HH:mm:ss', $null)

        # Get File Modified time
        $dtmMod = $objPicture.LastWriteTime

        # Convert if needed
        If ($dtmMod -ne $dtmTaken)
        {
            Try
            {
                $objPicture.LastWriteTime = $dtmTaken
                Write-Host "$strName`tUpdated modified date from $dtmMod to $dtmTaken" -ForegroundColor Green
            }
            Catch
            {
                Write-Host "$strName`tFailed to update modified date from $dtmMod to $dtmTaken" -ForegroundColor Red
            }
        }
        Else
        {
            Write-Host "$strName`tNo update needed - modified date is $dtmTaken" -ForegroundColor Yellow
        }
    }
    Else
    {
        Write-Host "$strName`tNo date taken info available" -ForegroundColor Cyan
    }
}

All you have to do is run it in the folder containing the files you want to "fix". I created this so that Facebook would tag them correctly. For whatever reason, they take the modified date (not even date created) as the appropriate date for the picture...

Answered by Duncan Clarke on April 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP