Modifying -alldates with a complicated filename [Facebook archive]

Started by DeJeR, November 27, 2017, 10:21:13 PM

Previous topic - Next topic

DeJeR

I used a plugin to download all of my tagged photos from Facebook. Unfortunately, all metadata is missing. The filename is complicated, but the date-taken is included in each name. For example:

fb_2006-01-18T01-09-55_535003631410.jpg

In this case, I would like to pull the following dates into the Alldates tag.
YYYY = 2006
MM = 01
DD = 18

For the sake of building a simple command line, the files are all located in C:\fb.

Can anyone help?

StarGeek

In that example, would the "01-09-55" happen to be the time for that image?  If so, then it's an easy command:
exiftool "-alldates<filename" C:\fb

If not, it's a bit more complex because all the tags encompassed by Alldates need a time as well as a date.  If you just use "00:00:00" as a filler, then you can uses
exiftool "-alldates<${filename;s/^fb_(\d{4})-(\d\d)-(\d\d).*/$1:$2:$3/i} 00:00:00"  C:\fb

Test it to make sure it's what you want. 

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).