Search inside any exif field

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
GUIguy
Posts: 131
Joined: 03 Jan 2016 02:11
Location: Oregon, USA Win 10-64;a 25H2; scale: 100%;XY: 28.10.01000

Search inside any exif field

Post by GUIguy »

A while back I used a digital asset manager and tagged many many photos in different exif fields. I subsequently abandoned that program.

Regardless of which exif field is used I would like to search all of my image files for the word "irrigation."

Can do?
GUIguy
Win 11-64; 25H2 (scale: 100%); XY: 28.30.06000

I measure a good day by how little I fell behind

Quick, hire a teenager while they still know everything!

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Search inside any exif field

Post by highend »

Via scripting and using get("exif"...)?
But with arbitrary field names, I wouldn't do it.

Use https://exiftool.org/ instead (ofc also via scripting)
Run it via runret() and then parse the output accordingly...
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3462
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Search inside any exif field

Post by jupe »

Alternatively, if you are not up to scripting it, using the same exiftool you could easily extract all exif data into a csv, and then import it into a spreadsheet or csv app which would allow easy filtering/searching, and exporting filename results to be opened in XY. eg,

recursive example:
exiftool -csv -r "C:\path\to\images" > metadata.csv

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Search inside any exif field

Post by highend »

E.g. (be in the (root) folder where you want to search for files containing the exif data):

Code: Select all

    $tool = "D:\Tools\@CLI Tools\exiftool\exiftool.exe";
    end (exists($tool) != 1), quote($tool) . <crlf 2> . "does not exist, aborted!";

    $find = input("Enter search term", 3:="e", 5:=250, 6:=150);
    if (trim($find) == "") { end true; }

    status "Running exiftool, stand by...", , "progress";
    $data = runret("""$tool"" -r ""<curpath>""", , 65001);

    $divider = "<:::::>";
    $pattern = "^========[\s\S]+?(?=^========|^\s+?\d+ directories)";
    $blocks  = regexmatches($data, $pattern, $divider);

    $files = "";
    foreach($block, $blocks, $divider, "e") {
        $file = gettoken($block, 1, <crlf>);
        $file = regexreplace($file, "^=+\s+");
        $file = replace($file, "/", "\"); // exiftool uses "/" instead of "\"
        if (strpos($block, $find) != -1) { $files .= $file . <crlf>; }
    }
    end (!$files), "No file(s) found containing the search term...";
    goto "vi:$files";
One of my scripts helped you out? Please donate via Paypal

Post Reply