ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: victorengel on May 07, 2024, 07:38:31 PM

Title: Batch update security cam photos
Post by: victorengel on May 07, 2024, 07:38:31 PM
Is it possible to batch update security cam photos from the file names? My security cam doesn't include any EXIF in the files. But the files are named in this format PYYMMDDHHMMSS00, where:

P is either P or A or possibly some other letter that changes according to what triggered the photo.
YY is the last two digits of the year.
MM is the numeric month.
DD is the day of month.
HH is 24 hour clock time.
MM is minutes.
SS is seconds.
00 is tacked on to the end. I suppose it's actually a sequential number, but I've never seen anything other than 00.
Title: Re: Batch update security cam photos
Post by: StarGeek on May 07, 2024, 08:20:26 PM
I'm assuming you want to add the timestamp to the EXIF data?

Assuming Windows CMD, try
exiftool "-AllDates<20$Filename" /path/to/files/

On Mac/Linux, change the double quotes to single quotes. I can't help if you insist on using Powershell, you'll have to figure out quotes yourself.

This is FAQ #5 (https://exiftool.org/faq.html#Q5). The only difference was the need to add 20 to complete the year.  Exiftool will ignore the A or P.

This command creates backup files.  Add -Overwrite_Original (https://exiftool.org/exiftool_pod.html#overwrite_original) to suppress the creation of backup files.  Add -r (https://exiftool.org/exiftool_pod.html#r-.--recurse) to recurse into subdirectories.
Title: Re: Batch update security cam photos
Post by: victorengel on May 07, 2024, 09:16:14 PM
Cool - I'll try it on my next batch of files. Thanks.
Title: Re: Batch update security cam photos
Post by: victorengel on May 08, 2024, 10:40:49 AM
Your trick of prepending with 20 did not work. Although I got an error message "no writable tags set..." the dates were updated, but the 20 was ignored, e.g., Create Date : 2404:03:11 00:36:00

Maybe I'll have to do a batch rename first.
Title: Re: Batch update security cam photos
Post by: victorengel on May 08, 2024, 10:50:14 AM
OK. That worked. Fortunately, this sort of batch rename is easy on a Mac. In Finder, select them all, then CTRL-click, select rename, then do a find/replace. It applies to all files in the selection.
Title: Re: Batch update security cam photos
Post by: StarGeek on May 08, 2024, 10:56:34 AM
Ok, try this instead.
exiftool '-AllDates<${filename;s/^./20/}' /path/to/files/

This time I actually tested it
C:\>exiftool -P -overwrite_original "-Alldates<${filename;s/^./20/}" Y:\!temp\x\y\P24050812015500.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -alldates Y:\!temp\x\y\P24050812015500.jpg
[ExifIFD]       DateTimeOriginal                : 2024:05:08 12:01:55
[ExifIFD]       CreateDate                      : 2024:05:08 12:01:55
[IFD0]          ModifyDate                      : 2024:05:08 12:01:55
Title: Re: Batch update security cam photos
Post by: victorengel on May 09, 2024, 04:05:20 PM
That works. Thanks.