is there a way to copy creation/modified date to exif tag of images via exiftool?

English support forum

Moderators: Hacker, petermad, Stefan2, white

giulia
Senior Member
Senior Member
Posts: 328
Joined: 2013-09-14, 05:33 UTC
Location: Europe

is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *giulia »

Hi
is there to copy creation/mofied date of a bunch of file to the exif tags using exiftool (seeing tc can write into image tags)?
maybe with a script
thanks , happy new year
love Total Commander , best file manager ever made
User avatar
solid
Power Member
Power Member
Posts: 749
Joined: 2004-08-09, 11:20 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *solid »

No, TC can't send date/time as parameter or write to EXIF tags.
Use XnView MP, it has a special dialog box for any type of date/time manipulation of both metadata and filedata.
giulia
Senior Member
Senior Member
Posts: 328
Joined: 2013-09-14, 05:33 UTC
Location: Europe

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *giulia »

solid wrote: 2022-12-29, 17:32 UTC No, TC can't send date/time as parameter or write to EXIF tags.
Use XnView MP, it has a special dialog box for any type of date/time manipulation of both metadata and filedata.
Hi Solid
i have always used xnview (not MP) but haven't a spacial dialog to copy created date file to exif data
thanks
love Total Commander , best file manager ever made
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *Stefan2 »

You would have to use TCs parameter like "%L" to work on all selected files,
together with a batch or script to call exiftool for each file (or on the whole folder).

Probably you can also just use a plugin to read and write meta tags.
I would have to search for this but me think others will help you out.

What would you prefer , exiftool or a plugin (if possible) ?



Β 
User avatar
solid
Power Member
Power Member
Posts: 749
Joined: 2004-08-09, 11:20 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *solid »

giulia wrote: 2022-12-29, 18:59 UTC Hi Solid
i have always used xnview (not MP) but haven't a spacial dialog to copy created date file to exif data
It is available in XnView classic too, although with just slightly less options.

Select the photos and go to menu Tools>Change timestamp...
You can change EXIF dates and/or file dates with EXIF date, file date or any other date.
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *Fla$her »

giulia wrote: 2022-12-29, 15:50 UTCmaybe with a script
Maybe (WIA or exiv2). Or jpg-comment plugin.
In which meta tags do you want to set the creation or modification dates?
Overquoting is evil! πŸ‘Ž
giulia
Senior Member
Senior Member
Posts: 328
Joined: 2013-09-14, 05:33 UTC
Location: Europe

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *giulia »

Fla$her wrote: 2022-12-30, 00:49 UTC
giulia wrote: 2022-12-29, 15:50 UTCmaybe with a script
Maybe (WIA or exiv2). Or jpg-comment plugin.
In which meta tags do you want to set the creation or modification dates?
hi
exif has a created data field
but i can 't copy the file date to the exif with the plugin you have linked
thanks
thanks
Stefan2 wrote: 2022-12-29, 19:38 UTC You would have to use TCs parameter like "%L" to work on all selected files,
together with a batch or script to call exiftool for each file (or on the whole folder).

Probably you can also just use a plugin to read and write meta tags.
I would have to search for this but me think others will help you out.

What would you prefer , exiftool or a plugin (if possible) ?
hi
exiftool is always updated and work with all the cameras and phones
thanks
love Total Commander , best file manager ever made
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *Fla$her »

giulia wrote: 2022-12-30, 07:57 UTC exif has a created data field
Are you talking about this tag?:
FileModifyDate
FileAccessDate
FileCreateDate
ModifyDate

DateTimeOriginal
CreateDate
DateTimeDigitized
MetadataDate
ProfileDateTime


Determine the exact format in CMD: exiftool -s test.jpg|find/i "date"
Overquoting is evil! πŸ‘Ž
giulia
Senior Member
Senior Member
Posts: 328
Joined: 2013-09-14, 05:33 UTC
Location: Europe

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *giulia »

Fla$her wrote: 2022-12-30, 16:20 UTC
giulia wrote: 2022-12-30, 07:57 UTC exif has a created data field
Are you talking about this tag?:
FileModifyDate
FileAccessDate
FileCreateDate
ModifyDate

DateTimeOriginal
CreateDate
DateTimeDigitized
MetadataDate
ProfileDateTime


Determine the exact format in CMD: exiftool -s test.jpg|find/i "date"
hi
I guess for exiftool the date taken by the cameras or the phones is DateTimeOriginal field

Code: Select all

[EXIF]          DateTimeOriginal
should copy created date of the file to the tag [EXIF] DateTimeOriginal
love Total Commander , best file manager ever made
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *Fla$her »

2giulia
ОК. Check this .vbs with the parameters for the button/em_command:

Code: Select all

'β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” VBS β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
' Purpose: Date Taken << Date Modified for selected JPEG files
' Parameters: %WL [/c]
' /c - change date source: Date Modified to Date Created
'β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Author: Flasher Β© β€”β€”β€”
Option Explicit: If WSH.Arguments.Count = 0 Then WSH.Quit
Dim Desk, FSO, IPr, Img, IsDC, List, F, oF, D, c
Set Desk = CreateObject("Shell.Application").NameSpace(0)
Set FSO  = CreateObject("Scripting.FileSystemObject")
Set IPr  = CreateObject("WIA.ImageProcess")
Set Img  = CreateObject("WIA.ImageFile")
IPr.Filters.Add IPr.FilterInfos("Exif").FilterID
IPr.Filters(1).Properties("Type") = 1002
IPr.Filters(1).Properties("ID")  = 36867
IsDC = WSH.Arguments.Named.Exists("c")
Setlocale 1100

Set List = FSO.OpenTextFile(WSH.Arguments(0),,,-1)
Do: F = List.ReadLine
   If Right(F, 1) <> "\" Then
   If InStr(1, "|jpg|jpeg|", "|" & FSO.GetExtensionName(F) & "|", 1) Then
      Set oF = FSO.GetFile(F)
      If IsDC Then D = oF.DateCreated Else D = oF.DateLastModified
      IPr.Filters(1).Properties.Item("Value") = Year(D) & ":" & Right("0" &_
      Month(D), 2) & ":" & Right("0" & Day(D), 2) & " " & Replace(TimeValue(D), ".", ":")
      Img.LoadFile F: IPr.Apply(Img).SaveFile F & "_"
      oF.Delete: FSO.GetFile(F & "_").Name = FSO.GetFileName(F)
      Desk.ParseName(F).ModifyDate = D: c = c + 1
   End If
   End If
Loop Until List.AtEndOfStream: List.Close

Set IPr = Nothing: Set Img  = Nothing
Set FSO = Nothing: Set Desk = Nothing
CreateObject("WScript.Shell").Popup "            Done!", 1.7, _
"  JPEG:  Date Modified " & ChrW(10142) & " Date Taken", 262208
Overquoting is evil! πŸ‘Ž
giulia
Senior Member
Senior Member
Posts: 328
Joined: 2013-09-14, 05:33 UTC
Location: Europe

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *giulia »

Fla$her wrote: 2022-12-31, 13:10 UTC 2giulia
ОК. Check this .vbs with the parameters for the button/em_command:

Code: Select all

'β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” VBS β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
' Purpose: Date Taken << Date Modified for selected JPEG files
' Parameters: %WL [/c]
' /c - change date source: Date Modified to Date Created
'β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Author: Flasher Β© β€”β€”β€”
Option Explicit: If WSH.Arguments.Count = 0 Then WSH.Quit
Dim Desk, FSO, IPr, Img, IsDC, List, F, oF, D, c
Set Desk = CreateObject("Shell.Application").NameSpace(0)
Set FSO  = CreateObject("Scripting.FileSystemObject")
Set IPr  = CreateObject("WIA.ImageProcess")
Set Img  = CreateObject("WIA.ImageFile")
IPr.Filters.Add IPr.FilterInfos("Exif").FilterID
IPr.Filters(1).Properties("Type") = 1002
IPr.Filters(1).Properties("ID")  = 36867
IsDC = WSH.Arguments.Named.Exists("c")
Setlocale 1100

Set List = FSO.OpenTextFile(WSH.Arguments(0),,,-1)
Do: F = List.ReadLine
   If Right(F, 1) <> "\" Then
   If InStr(1, "|jpg|jpeg|", "|" & FSO.GetExtensionName(F) & "|", 1) Then
      Set oF = FSO.GetFile(F)
      If IsDC Then D = oF.DateCreated Else D = oF.DateLastModified
      IPr.Filters(1).Properties.Item("Value") = Year(D) & ":" & Right("0" &_
      Month(D), 2) & ":" & Right("0" & Day(D), 2) & " " & Replace(TimeValue(D), ".", ":")
      Img.LoadFile F: IPr.Apply(Img).SaveFile F & "_"
      oF.Delete: FSO.GetFile(F & "_").Name = FSO.GetFileName(F)
      Desk.ParseName(F).ModifyDate = D: c = c + 1
   End If
   End If
Loop Until List.AtEndOfStream: List.Close

Set IPr = Nothing: Set Img  = Nothing
Set FSO = Nothing: Set Desk = Nothing
CreateObject("WScript.Shell").Popup "            Done!", 1.7, _
"  JPEG:  Date Modified " & ChrW(10142) & " Date Taken", 262208
Hi
thanks a lot , hope it works with raw files too like .CR2 .NEF or .ARW
happy new year
love Total Commander , best file manager ever made
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *Fla$her »

2giulia
These file types are not specified in the title. I have not worked with such. Throw off the examples with Date Taken, if it's not difficult.

And Happy New Year to you.
Overquoting is evil! πŸ‘Ž
giulia
Senior Member
Senior Member
Posts: 328
Joined: 2013-09-14, 05:33 UTC
Location: Europe

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *giulia »

hi
in short there is no way to parse created date to exiftool?
love Total Commander , best file manager ever made
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1050
Joined: 2004-07-29, 11:00 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *ZoSTeR »

Β 
Here's a PowerShell script that writes the file creation date to the Exif tag "datetimeoriginal" with exiftool.

Put the exiftool.exe next to the script.

Script "Set-Exif-DateTimeOrg-to-FileCreationDate.ps1"

Code: Select all

Param(
    [Parameter(Mandatory=$True)]
    [ValidateNotNullOrEmpty()]
    [string]$FileList
)

# Path to ExifTool.exe, adjust to taste
$exifToolExe = "$PSScriptRoot\Exiftool.exe"

[array]$contentFileList = Get-Content -LiteralPath $FileList

$answer = Read-Host -Prompt "Change date for $($contentFileList.Length) files?"

if (("y","Y","j","J") -contains $answer)
{
    foreach ($filePath in $contentFileList)
    {
        #Check if path exists and is a file
        if (Test-Path -LiteralPath $filePath -PathType Leaf)
        {
            Write-Output "File Path: $filePath"

            $fileItem = Get-Item -LiteralPath $filePath

            $fileLastWriteTime = $fileItem.LastWriteTime
            $fileLastWriteTimeString = $fileLastWriteTime.ToString("yyyy:MM:dd HH:mm:ss")
            Write-Output "File Last Write Time: $fileLastWriteTimeString"

            $fileCreationTime = $fileItem.CreationTime
            $fileCreationTimeString = $fileCreationTime.ToString("yyyy:MM:dd HH:mm:ss")
            Write-Output "File Creation Time:   $fileCreationTimeString"

            Write-Output "Setting new Exif-Time"
            
            # ExifTool call. Adjust parameters to taste
            &$exifToolExe -datetimeoriginal="$fileCreationTimeString" $filePath
        }
    }
}
Put in on a button and adjust the script path (copy&paste to TC buttonbar):

Code: Select all

TOTALCMD#BAR#DATA
powershell.exe
-NoExit -ExecutionPolicy remotesigned -Command "&{&'c:\AdjustPath\Set-Exif-DateTimeOrg-to-FileCreationDate.ps1' -FileList '%L'}"
powershell.exe
Set Exif DateTimeOrg to FileCreationDate


-1
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: is there a way to copy creation/modified date to exif tag of images via exiftool?

Post by *Fla$her »

giulia wrote: 2023-01-05, 16:13 UTCin short there is no way to parse created date to exiftool?
Exiftool is not a standalone utility. At the first launch, she unpacks her perl distribution into the Temp folder for 20+ seconds, leaving all this garbage there. There's nothing good about it. That's why I suggested more optimal tools.
Are you not satisfied with my decision in some way? It's worth starting with this. And I asked to provide files with the specified extensions. Where are they?
Overquoting is evil! πŸ‘Ž
Post Reply