Page 1 of 1
Setting Metadata "Date taken" to the files created date
Posted: 24 Oct 2025 17:34
by Schuller
I have about 2 million JPEG images that was taken from several security cameras by either its live stream or the camera's snapshot URI option and these photo's have no date taken in its metadata plus I see no option on these devices to have that included in the Metadata. Can XY be used to set the Metadata "Date taken" to match the created date of these files?
Re: Setting Metadata "Date taken" to the files created date
Posted: 24 Oct 2025 17:56
by highend
Not without the help of exiv2 or exiftool
E.g.:
https://exiv2.org/builds/exiv2-0.28.7-2022msvc.zip
Adapt the $exif variable and use it on some test images first (which you should put outside of the root of your real image root for the two million files)!
Don't run it over 2 million files all at once, change into different subdirs to do this stuff in parts (because otherwise the string space of XY will be overflowing) xD
Code: Select all
$exif = "D:\Tools\@CLI Tools\exiv2\exiv2.exe";
end (exists($exif) != 1), quote($exif) . <crlf 2> . "does not exist, aborted!";
$images = quicksearch("/types=jpg", 3:="s");
end (!$images), "No image(s) found, aborted!";
$batFile = "%TEMP%\~xy_change_exif_dates.bat";
$batHeader = "@ECHO OFF & CLS";
$batContent = "";
foreach($image, $images, <crlf>, "e") {
$cDate = property("#date.c", $image);
$cDate = formatdate($cDate, "yyyy:mm:dd hh:nn:ss");
$batContent .= "ECHO Tagging " . quote($image) . <crlf>;
$normal = " -M" . quote("set Exif.Image.DateTime $cDate");
$original = " -M" . quote("set Exif.Image.DateTimeOriginal $cDate");
$batContent .= quote($exif) . $normal . $original . " " . quote($image) . <crlf 2>;
}
$batFooter = <<<>>>
:END
ECHO. & ECHO Press any key to continue... & PAUSE >NUL
>>>;
$batFooter = regexreplace($batFooter, "^[ \t]+");
$batContent = $batHeader . <crlf 2> . $batContent . <crlf> . $batFooter;
writefile($batFile, $batContent, , "utf8");
run $batFile, "%TEMP%", 0, 1;
Re: Setting Metadata "Date taken" to the files created date
Posted: 24 Oct 2025 21:48
by Schuller
I ran the script and it appears to have set the EXIF Date/Time Original to the created date of the file where that had not existed before. I see that when I select an updated file & click on preview in the info panel. I don't see the date taken though when clicking on Meta tab on the info panel as I can see the date taken with my phones camera when I click on the Meta tab. It looks like there are two types of "Date taken", one in shell properties and one in special properties. I can see date taken of these updated files under special properties & not shell properties. Is that how its suppose to work?
Re: Setting Metadata "Date taken" to the files created date
Posted: 24 Oct 2025 22:19
by highend
What?
Show screenshots of what you can see (and where)...
Re: Setting Metadata "Date taken" to the files created date
Posted: 25 Oct 2025 20:05
by Schuller
This is a file where the EXIF Date/Time Original was set to match the created date after running the script as you can see it is indicated near the bottom right of the screenshot. It had no EXIF date before running the script.

- Screenshot 2025-10-25 125006-1.png (293.29 KiB) Viewed 2777 times
This is the exact same same file, also after running the script but with the Meta tab selected and you see it shows no Date taken.

- Screenshot 2025-10-25 124837-1.png (79.02 KiB) Viewed 2777 times
And again, this is the exact same file, also updated/date set after running the script, but I right clicked on this one and selected Metadata and you will see the Date Taken is under Special Properties and is not shown under Shell Properties.

- Screenshot 2025-10-25 124725-1.png (163.67 KiB) Viewed 2777 times
It seems everything is okay.
Some confusion set in when I selected a photo that was taken by my Phone(no script ran) and NOT a security camera and I selected the exact same options as above and noticed it was displayed in different areas. The Date taken WAS shown under Shell properties AND Special properties and that date taken is is also shown under the Meta tab but nothing is shown at the bottom right when selecting preview. This is what led me to ask are there two types of "Date Taken", one in shell properties and one in special properties.
Re: Setting Metadata "Date taken" to the files created date
Posted: 25 Oct 2025 20:24
by Schuller
I don't think I'm going to proceed this way because it is to cumbersome and it would create a bottle neck for what I was trying to achieve which was to use both of the only two date sorting options on Amazon Photos when using my phone app. These two date sorting options are: Sort by Date uploaded or by Date Taken. Basically some of the security cameras are only taking snapshots photos and not video and the moment the photos hit my desktop, which is pretty much instantly after motion detected, they get uploaded to Amazon photos immediately where photo storage is unlimited and I can view pretty much immediately on my phone anywhere and use Amazon's AI to sort/search by a number of things (except take taken)