Hi, I've added exiftool command to batch file but I can't get seem to get step 4 & 5 to work even though it's already on the default directory.
If I manually run the same command it works fine, anything I'm missing here?
REM - Step 1 Convert all PNG to PNG
@echo off
setlocal enabledelayedexpansion
REM Set the directory containing the .PNG files
set "directory=C:\Users\keel\Downloads\Compressed\Takeout\Google Photos\test"
REM Change directory to the specified one
cd /d "%directory%"
REM Loop through each .PNG file in the directory
for %%F in (*.PNG) do (
REM Convert the .PNG file to .PNG format using ImageMagick
magick "%%F" "%%~nF.PNG"
)
echo Conversion complete.
REM - Step 2 - convert all HEIC to JPG
REM Convert HEIC files to JPG format
magick mogrify -format jpg *.heic
REM Remove original HEIC files
del *.heic
echo Conversion completed.
REM - Step 3 - rename duplicated .json files script
exiftool -ext json -r -if "$Filename=~/(\.[^.]+)(\(\d+\)).json$$/i" "-Filename<${Filename;s/(\.[^.]+)(\(\d+\)).json$/$2$1.json/}" .
REM - Step 4 - use exiftool to update mp4, mov, jpg, jpeg, gif, png
exiftool -overwrite_original -ext png -ext jpg -ext mp4 -ext gif -ext mov -ext jpeg -d "%s" -TagsFromFile %d%f.%e.json "-FileCreateDate<${PhotoTakenTimeTimestamp}" "-FileModifyDate<${PhotoTakenTimeTimestamp}" "-SubSecDateTimeOriginal<${PhotoTakenTimeTimestamp}" .
echo metadata updated.
REM - Step 5 - use exiftool to update live videos mp4 & jpg fom heic.json
exiftool -overwrite_original -ext jpg -ext mp4 -d "%s" -TagsFromFile %d%f.HEIC.json "-FileCreateDate<${PhotoTakenTimeTimestamp}" "-FileModifyDate<${PhotoTakenTimeTimestamp}" "-SubSecDateTimeOriginal<${PhotoTakenTimeTimestamp}" .
echo metadata for live photos updated.
pause
Logs
REM - Step 1 Convert all PNG to PNG
Conversion complete.
Conversion completed.
1 directories scanned
5 files failed condition
3 image files updated
0 image files read
The system cannot find the file specified.
metadata updated.
The system cannot find the file specified.
metadata for live photos updated.
Press any key to continue . . .
FAQ #27, My ExifTool command doesn't work from a Windows .BAT file (https://exiftool.org/faq.html#Q27)
Quote from: StarGeek on April 04, 2024, 02:46:34 PMFAQ #27, My ExifTool command doesn't work from a Windows .BAT file (https://exiftool.org/faq.html#Q27)
Thanks, I probably should've checked the FAQs first