Filter list with values only including certain text

I have a macro that reads the files listed in a folder and sets a variable to the names. I only want to work with files that the name of the file contains _OCR. How can I filter my list of file names to show only those file names with _OCR included?

An example of a list of file names in a folder could be:

I am open to either filtering the list or learning how to set the initial variable of only files in a folder that contains _OCR in their name.

Thanks to anyone that can help!

If I understood you correctly, here is a quick example to get you started:

I tested this but make sure you test this out some demo files first.
This just searches for the files containing _OCR and replaces it with the date- for demo purposes. Your area of focus is the If statement with the Variable contains _OCR portion. From there, you can do what you want.

Try it out and let us know. We may be able to get you closer to what you are trying to accomplish.


Here's an example macro that does what you ask, and more, so it should be a good guide you can use for your macro:

MACRO: Get List of FileNames That Match Criteria [Example]