Copy link to clipboard
Copied
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?
2 Correct answers
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
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
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)?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Ok, that's a shame. It would be a useful extra for the Find-tool
Anyhow, my problem still exists so I am more than eager to try ExifTool. I'm not hugely skilled with CLI tools, but also not new with the. So the code would be hugely appreciated. I think I can get it to work 🙂
Copy link to clipboard
Copied
The following Mac OS Terminal ExifTool command line code will scan the top-level directory "My Folder" on the Desktop of a user named "jill" for any file that contains the required metadata and list the results in the Terminal window:
exiftool -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -XMP-skyview:CustomField21 '/Users/jill/Desktop/My Folder/'
This Mac OS Terminal ExifTool command line code will add a blue Adobe Bridge Label "Review" to any matching files.
exiftool -overwrite_original_in_place -if '$XMP-skyview:CustomField21 =~ /Hiekkalaatikko/' -label='Review' '/Users/jill/Desktop/My Folder/'
Instead of using a label, a Bridge rating could be used, such as 5 stars... Or perhaps a keyword or other metadata value could be added. Or the file could be renamed or moved to another directory. There are many possibilities.
If you are using MS Windows, then all single straight quotes need to be changed to double straight quotes and the appropriate Windows directory path needs to be used.
Let me know if you need anything clarified.
Copy link to clipboard
Copied
Thanks! You've already been a huge help!
ExifTools seems like the way to go.
For my current task the best method would be to move the files in question to another directory. Could you provide a script for that (Find files with CustomField21=Hiekkalaatikko --> Move to directory called Hiekkalaatikko)? This would be a killer!
Copy link to clipboard
Copied
All Criteria is an AND so that search would require both items.
You could also write a custom search script to find this data.
Copy link to clipboard
Copied
Thanks for the info, both of you!
A working script is something that I'm now trying to figure out. All help is appreciated.
Copy link to clipboard
Copied
I'm an experienced Bridge scripter and the search scripting is beyond opaque. I'd recommend using EXIFTool and writing a shell script or using my Run EXIFTool script in Bridge (it integrates Bridge and EXIFTool.)
https://www.dropbox.com/sh/mg817g9a9ymbasi/AADTmXUVxmFfM58bcyYE7yiwa?dl=0
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
That worked as well. Thank you so much! You're a legend 😄

