Search multiple filenames in Ctrl+F

Ask for help and post your question on how to use XnView MP.

Moderator: xnview

Post Reply
FKCapitalism2
Posts: 339
Joined: Sun Apr 23, 2023 5:14 am

Search multiple filenames in Ctrl+F

Post by FKCapitalism2 »

When using Ctrl+F box to search for files can specify DSC07503.dng|DSC07505.dng|DSC07508.dng then check Use Regular Expression and it finds all files, is there simpler syntax to specify multiple files without resorting to regular expression?

e.g. something like: DSC07503.dng, DSC07505.dng, DSC07508.dng
jkm
Posts: 194
Joined: Sat May 11, 2024 12:43 am

Re: Search multiple filenames in Ctrl+F

Post by jkm »

Leave the upper filename field blank, and add filename as a condition in the lower part of the dialog.

You can then use booleans to search for any combination of filenames you want.
FKCapitalism2
Posts: 339
Joined: Sun Apr 23, 2023 5:14 am

Re: Search multiple filenames in Ctrl+F

Post by FKCapitalism2 »

jkm wrote: Thu Dec 25, 2025 9:18 am Leave the upper filename field blank, and add filename as a condition in the lower part of the dialog.

You can then use booleans to search for any combination of filenames you want.
Unfortunately that did not work, can't specify one by one, need to paste list of 100+ image names.

1.jpg
1.jpg (55.16 KiB) Viewed 43 times
jkm
Posts: 194
Joined: Sat May 11, 2024 12:43 am

Re: Search multiple filenames in Ctrl+F

Post by jkm »

It does not work because you're using improper syntax. But I don’t think it’s documented anywhere so you couldn’t have known except for experimentation.

And if you'd said at the outset you insist on searching for 100+ filenames in a single line because you want to paste them in, you could have saved us both a lot of time... So, sorry if you don't like this answer. I imagine you felt by simplifying you were making it easier on whoever would help you, but unfortunately it's the scale that makes the difference in this case.

Instead of just telling you to forget it and use regex, I'll explain; perhaps it will help others that read this.

First, when using the contains operator as you show in your screenshot, you can use wildcards, but otherwise it is expecting a single string. So you can't concatenate filenames with spaces like you're showing; it's nonsensical and unmatchable.

You could add multiple conditions of filename, each with a single filename target string which could contain wildcards. The hint for you to do that was when I said you could use booleans. Booleans require multiple operands.

But now you want to paste hundreds of filenames on a single line; that's new from your original post.

The only other way you can do something like that is to use the "is any of" operator. With that operator, you separate your target strings with semicolons, or pipes. So it would look like:
Filename is any of file1;file2;file3

or

Filename is any of file1|file2|file3

It's semicolons or pipes. You may not use commas, spaces, or any other separator.
But this is effectively the same as what you were already doing, separating with pipes using regex.

FYI: due to a bug in the application, "search in catalog only" must NOT be checked when performing this type of search, or it will return no results.

If you examine the options on the Add>> menu, you will see that other filename-related conditions exist. One for example is Filename (with extention) which you could use instead if you wanted to specify the extension or discriminate by it.

As for pasting "100+" filenames, good luck with that. I have no idea if it will work or how long the maximum string the dialog will allow is. If you have problems because of excessive length, I suggest you find another program to help you manipulate your files. Your approach I find extremely unorthodox; but I'm trying to help you anyway.

In my opinion, this method for finding lots of filenames on a single line is NOT simpler than what you were already doing with regex. You were separating filenames with a pipe, now you're separating with a semicolon or a pipe. It's the same. So if you'd said the "I want to paste in 100 filenames on a single line" in the first place, I just would have told you to keep using regex. So it was a waste of time for both of us, I'm afraid. But perhaps there's some value for others in documenting the ins and outs of something like this.

Simple approaches (as in simpler than regex) are for onesey-twosey searches. To do something like 100 files in a single line, unfortunately the simplest solutions won't work.

In the odd situation of trying to paste in 100+ filenames from some external source, regex is in my view the simplest way, and I honestly don't understand your objection to how you were doing it. Separating the filenames with a pipe and pasting them into a single line, clicking use regex and clicking Search seems pretty easy to me. Perhaps I have a limited imagination, but I don't see how it gets easier, except with telepathy.

Also keep in mind if this is a repetitive thing you're going to do of searching for the same set of filenames, you can save the search as a preset or as a smart album, so you don't have to keep pasting in the same list.

Hopefully this helps. Good luck.
Post Reply