Batch update security cam photos

Started by victorengel, May 07, 2024, 07:38:31 PM

Previous topic - Next topic

victorengel

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.

StarGeek

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. 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 to suppress the creation of backup files.  Add -r to recurse into subdirectories.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

victorengel

Cool - I'll try it on my next batch of files. Thanks.

victorengel

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.

victorengel

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.

StarGeek

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
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

victorengel