FileName pattern revision and others

Started by jmsantos, October 03, 2025, 07:06:59 PM

Previous topic - Next topic

jmsantos

I have a complex question.

My job sometimes involves reviewing photographs taken by other photographers, who must submit their images according to guidelines set by my organisation. They also have to enter metadata that I have to review to ensure it meets the criteria established by the organisation.

I use IMatch to do this review, among other things. Sometimes I receive work with errors that I have to locate and correct, but sometimes I overlook them. One of the aspects to check is that the file names must follow a specific pattern:
nnnnnnnnnnnnnnn_nnnn.ext
That is, 15 digits + 4 digits (separated by a underscore) + file extension.

I also have to check that the JobID metadata matches the file name without the extension.

I think the File Viewer could visually highlight potential problems, without having to check each photo individually. I have studied the help section on formula-based categories and variables, but I am quite lost.

Any clues that might help me?

Mario

Just q quick first take, I don't have much time now.

Variables are probably a way to go.
In  VarToy, enter these variables:

{File.MD.jobid}
{File.Name}
{File.MD.jobid|is:{File.Name},OK,FAIL}

The 3 row compares the job id with the file name (without extension) and emits OK when they match and FAIL otherwise.
If you use the 3rd variable in a custom File Window layout, you can display OK or FAIL to immediately see which files fail.

Or, you use the variable in a Metadata Template to fill a tag of your choice with OK or FAIL. Then you can search for FAIL or make a data-driven category for the tag you used, automatically grouping files into OK and FAIL categories. All you need to do is to run the Metadata Template on the incoming files.

As for the 15_4 requirement, IMatch has no variable function that checks if characters are digits.
What you can do for a start is this:

{File.Name|substr:15,1;is:_,OK,FAIL}
This variable returns OK when there is an underscore at position 15 (0-based), else it emits FAIL.

For a more strict check, you must use a regexp with {File.Name} that checks the specific number of digits, the _, the other number of digits and the . See Regular Expressions and the links and tools listed there.

I have no time at the moment to figure this out for you, sorry.

Mario

#2
I've given this some additional thought, and I think this will work.

{File.NameExt|regexp:^[0-9]{15}_[0-9]{4}\..*$//!,OK,FAIL}
This regex checks for 15 digits, an underscore, 4 digits, a dot and then anything. It returns OK or FAIL.
I gave this a few tests and it seems to work. Test it carefully.

Using both variables in a custom File Window layout allows you to immediately see if a file matches the requirements.
You could also create data-driven categories from both variables (make them manual update) and group files into OK and FAIL.

Put this into VarToy and run some tests:

JobId: {File.MD.jobid}
File name: {File.Name}
JobId: {File.MD.jobid|is:{File.Name},OK,FAIL}
File name: {File.NameExt|regexp:^[0-9]{15}_[0-9]{4}\..*$//!,OK,FAIL}

Isn't IMatch awesome  :)

jmsantos