Skip to main content
Participating Frequently
November 30, 2023
Answered

Search / filter images by custom metadata field

  • November 30, 2023
  • 4 replies
  • 1355 views

Hi,

 

I need to find and/or filter files (especially images) by metadata stored in custom field. This particular metadata can be seen in file info, and it can be also found when search is done to all metadata fields. However, this doesn't help me since I would need to focus the search in the mentioned custom field.

 

Is there some way to work with this matter?

This topic has been closed for replies.
Correct answer Stephen Marsh

@Sami33901227vjt3 

 

The following ExifTool code will conditionally move the matching files to a new folder named 'Hiekkalaatikko':

 

exiftool -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -directory=%d'Hiekkalaatikko' '/Users/jill/Desktop/My Folder/'

 

Keep in mind that this is simply processing the top-level of the target folder. You can add the -r or -recurse flag/argument to drill into nested sub-directories.

 

4 replies

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
December 1, 2023

@Sami33901227vjt3 

 

The following ExifTool code will conditionally move the matching files to a new folder named 'Hiekkalaatikko':

 

exiftool -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -directory=%d'Hiekkalaatikko' '/Users/jill/Desktop/My Folder/'

 

Keep in mind that this is simply processing the top-level of the target folder. You can add the -r or -recurse flag/argument to drill into nested sub-directories.

 

Participating Frequently
December 1, 2023

Ok it took some time to learn how to use Exiftool, but it sure did do just what I wanted it to do! My learning curve has been phenomenal, thanks to you guys! 😄

 

I will now try to run this in the bigger folders - that in mind I would like to see what is going on, and save some log file.

I added -progress in the end of the command and it showed some information, but can I also save a log file of the progress?

Stephen Marsh
Community Expert
Community Expert
December 1, 2023

In addition to -progress, ensure that there is a space then add the following at the very end:

 

> 'path/to the/log.txt'

 

You may also wish to look into -v or -verbose

 

https://exiftool.org/exiftool_pod.html

Stephen Marsh
Community Expert
Community Expert
December 1, 2023

@Sami33901227vjt3 

 

You can use the Bridge script "Expert Search" from Paul Riggott to create a collection from the specific search criteria:

 

https://github.com/Paul-Riggott/PS-Scripts/blob/master/Expert%20Search.jsx

 

Participating Frequently
December 1, 2023

Well this does the trick, thanks!

 

However since I have some directories with a huge amount of files, Bridge tends to crash (or at least take years to process). I guess I could work around this by dividing files to smaller directories. But since ExifTool might get it done without the manual labor, I think I have to try it out first.

Stephen Marsh
Community Expert
Community Expert
November 30, 2023

So the value (location name) is variable and not static/fixed. You may need to change and or add/remove extra criteria as required.

 

A simple Edit > Find (which can then be saved as a dynamic smart collection) does the job:

 

Participating Frequently
November 30, 2023

Sorry if I got something wrong, but this leaves me with a problem since the first criteria is found in all files, the latter criteria is found from other metadata fields in other files.

What would work for me (as far as I understand) is if the search would find "Hiekkalaatikko" from skyview:CustomField21. Or the whole text "<skyview:CustomField21>Puulajipuisto</skyview:CustomField21>", but I guess it doesn't work that way (look for such string)?

Stephen Marsh
Community Expert
Community Expert
November 30, 2023

Unfortunately Adobe doesn't let one use the < > characters in find. 

So this would then need a custom script.

 

If you're not adverse to using a CLI tool, then I can probably give you the code for ExifTool.

 

https://exiftool.org

Stephen Marsh
Community Expert
Community Expert
November 30, 2023

Can you attach a copy of the file with embedded custom metadata? You can crop the file to a small size as it's only the metadata that's important. Please note which is the custom field and if the value is static or variable.

Participating Frequently
November 30, 2023

For sure,

 

The custom field that i'm looking for is:

<skyview:CustomField21>Hiekkalaatikko</skyview:CustomField21> 

Not sure what you mean by static/variable value? This metadata was input as text and it varies from image to image (tells the original location where the image was stored).

 

Thanks for the help!