1

I'm using freefilesync to synchronize two folders containing photos

Is there a software that can compare the image metadata to see what metadata changes have been made?

1 Answer 1

1

Ok I found a way myself.

I updated a script I found online to make it work, and created a powershell version as well.

@echo off
:: Compare_EXIF.cmd Compare EXIF-Meta-Data V1.6
setlocal enableextensions enabledelayedexpansion &  if errorlevel 1 ( echo Can not set local & pause & exit/b 99 )

:: ARGUMENTS
:: either two dirs with same named pics, Wildcards are not possible, choose mask for dir comparison
set WILD=*.jpg
:: or two pics

:: NEEDS
:: exiftool http://www.sno.phy.queensu.ca/~phil/exiftool/ set the correct path here
set EF="exiftool.exe"
:: Winmerge http://winmerge.org  set the correct path here
set WM="WinMergeU.exe"

:: for DEBUGGING uncomment
set DEBCMD=echo ~ 

:: START BATCH

:: Functions
set EXITE=echo. ^& pause ^& exit/b 99

:: Initialization
cls
if not defined DEBCMD ( set DEBCMD=rem ) else %DEBCMD% Using debug command: %DEBCMD%

:: exiftool commandline
if not exist %EF% ( echo ExifTool %EF% not found % %EXITE% )
:: Instead of excluding here, may use LineFilter in Winmerge
set EF=%EF% -groupHeadings --FileModifyDate
%DEBCMD% exiftool (found) %EF%

:: Winmerge commandline
if not exist %WM% ( echo ExifTool %WM% not found % %EXITE% )
:: /s single instance
:: /e for end with escape
:: /x for message and end if equal
:: /ul /ur don't add to history left & right
:: /wl /wr read only left & right
set WM=%WM% /s /e /x /ul /ur /wl /wr 
%DEBCMD% Winmerge (found) %WM%

:: Check Argument/1
set D1=%~dp1
set N1=%~nx1
set ISDIR1=%~a1
set ISDIR1=%ISDIR1:~0,1%
if ~%ISDIR1%~==~d~ (
    set D1=%1
    set N1=%WILD%
)
%DEBCMD% Arg/1 %1% 
%DEBCMD% Path/1 %D1% & %DEBCMD% Name/1 %N1% & %DEBCMD% Attributes/1 %ISDIR1%
if not exist %1 ( echo 1st File/s %1? & %EXITE% )

:: Check Argument/2
set D2=%~dp2 
set N2=%~nx2
set ISDIR2=%~a2
set ISDIR2=%ISDIR2:~0,1%
if ~%ISDIR2%~==~d~ (
    set D2=%2
    set N2=%WILD%
)
%DEBCMD% Arg/2 %2% 
%DEBCMD% Path/2 %D2% & %DEBCMD% Name/2 %N2% & %DEBCMD% Attributes/2 %ISDIR2%
if not exist %2 ( echo 2nd File/s %2? & %EXITE% )

:: No Argument/3
if not ~%3~==~~ ( echo Only 2 args, either 2 files or 2 dirs, NO WILDCARDS &  %EXITE% )

:: Check constency of arguments
%DEBCMD% Matched Attributes %ISDIR1%%ISDIR2%
%DEBCMD% Directories/Files? ~%ISDIR1%%ISDIR2%~
if ~%ISDIR1%%ISDIR2%~==~dd~ ( echo Comparing two directories & goto compare )
if ~%ISDIR1%%ISDIR2%==~--~ ( echo Comparing two files & goto compare )
::%EXITE% Can only compare two dirs or two files

:compare
:: Temporary Files
::if not defined TEMP (echo TEMP-Directory defined & %EXITE%) else %DEBCMD% Using TEMP: %TEMP%
set T1="%TEMP%\%~n0_1.tmp"
set T2="%TEMP%\%~n0_2.tmp"
%DEBCMD% Temp 1: %T1% & %DEBCMD% Temp 2: %T2%

:: Run first arg
echo.
echo exiftool/1
echo File/s: %N1%
echo in: %D1%
cd /d %D1%
%DEBCMD% "%EF% %N1% > %T1%"
%EF% %N1% > %T1% 
if errorlevel 1 ( echo ExifTool/1 Error on %1 & %EXITE% )
if not exist %T1% ( echo Not found: %T1% & %EXITE% )

:: Rund second arg
echo.
echo exiftool/2
echo File/s: %N2%
echo in: %D2%
cd /d %D2%
%DEBCMD% "%EF% %N2% > %T2%"
%EF% %N2% > %T2% 
if errorlevel 1 ( echo ExifTool/2 Error on %2 & %EXITE% )
if not exist %T2% ( echo Not found: %T2% & %EXITE% )

:: /dl /dr Description left & right
%DEBCMD% start "WinMerge" /b %WM% /dl %1 /dr %2 %T1% %T2%
start "WinMerge" /b %WM% /dl %1 /dr %2 %T1% %T2%

And then I defined the script as an external tool in FreeFileSync

Compare Image Metadata     Compare_EXIF.cmd  "%local_path%" "%local_path2%"

Powershell Version

#requires -version 4
<#
.SYNOPSIS
  Compare metadata of two Image Files using EXIF tool & WinMerge
.DESCRIPTION
  Compare metadata of two Image Files using EXIF tool & WinMerge
  Extracts the metadata using EXIF
  Launches Winmerge with the two text files
.PARAMETER File1
  Full Path for file1
.PARAMETER File2
  Full Path for file2
.INPUTS
  Files
.OUTPUTS
  Text files
.NOTES
  Version:        1.0
  Author:         Vijay Saraff
  Creation Date:  2016-10-16
  Purpose/Change: Initial script development
.EXAMPLE
  Compares the metadata of two files called a.jpg and b.jpg

  CompareEXIF.ps1 a.jpg b.jpg
#>

#---------------------------------------------------------[Script Parameters]------------------------------------------------------

Param (
  #Script parameters go here
  $file1 = $(throw "need a file to compare"),
  $file2 = $(throw "need a file to compare")
)

#---------------------------------------------------------[Initialisations]--------------------------------------------------------

#Set Error Action to Silently Continue
$ErrorActionPreference = 'SilentlyContinue'

#Import Modules & Snap-ins

#----------------------------------------------------------[Declarations]----------------------------------------------------------

#Any Global Declarations go here
$exiftool = "D:\Pix\Apps\exiftool.exe"
$exifparameters = " -groupHeadings --FileModifyDate"
$winmerge = "Z:\Share\DropboxVJ\Dropbox\LiberKey\Apps\WinMerge\WinMergeLKL.exe"
# /s single instance
# /e for end with escape
# /x for message and end if equal
# /ul /ur don't add to history left & right
# /wl /wr read only left & right
$winmergeparams = " /s /e /x /ul /ur /wl /wr "

#-----------------------------------------------------------[Functions]------------------------------------------------------------


Function ExtractMetatdata {
  Param ($file = $(throw "need a file"))
  Begin {
    #Write-Host '<description of what is going on>...'
  }
  Process {
    Try {
      if (!(Test-Path($file))) { throw "$file not found" }
      $tmpfile = New-TemporaryFile
      #Write-Debug $exiftool $exifparameters $file > $tmpfile
      & $exiftool $exifparameters $file > $tmpfile
      Return $tmpfile
    }
    Catch {
      Write-Host -BackgroundColor Red "Error: $($_.Exception)"
      Break
    }
  }
  End {
    If ($?) {
      #Write-Host 'Completed Successfully.'
      #Write-Host ' '
    }
  }
}

#-----------------------------------------------------------[Execution]------------------------------------------------------------

#Script Execution goes here
if (!(Test-Path($exiftool))) { throw "ExifTool.exe not found" }
if (!(Test-Path($winmerge))) { throw "Winmerge not found" }
$tmp1 = ExtractMetatdata($file1)
$tmp2 = ExtractMetatdata($file2)
Write-Host $tmp1.FullName
#Write-Host (Get-Content $tmp1)
Write-Host $tmp2.FullName
#Write-Host (Get-Content $tmp2)
& ".\EchoArgs.exe" $winmerge $tmp1 $tmp2 $winmergeparams "/dl " "$file1" "/dr " "$file2" 
& $winmerge $tmp1 $tmp2 $winmergeparams "/dl " "$file1" "/dr " "$file2" 
if (!(Test-Path($tmp1))) { Remove-Item $tmp1.FullName -Force }
if (!(Test-Path($tmp2))) { Remove-Item $tmp2.FullName -Force }

You have to ensure all your paths are correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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