Find all files on Windows 7 that match a search pattern

I need to find and delete all files on a computer that match a certain pattern.  This needs to be a careful search because other files that do not match the pattern should not be included so that they are not deleted.  The pattern is:

(from Thearclink_aa_n)

where "aa" is a two letter abbreviation and "n" is a number.  This will only be part of the file name, but will always be the end of the file name before the extension.  For example, if there is a file "foo.txt", there may be "foo (from Thearclink_in_1).txt" or "foo (from Thearclink_mi_1.txt" or "foo (from Thearclink_in_0.txt".  I want the last 3 to be returned but not the first and certainly not anything else.  Since this is a specific pattern, I do not think there will be any false positives, however it is important the original file is not returned.

I am using Windows 7 which uses a search I am not comfortable using.  When I try searching for "(From thearclink_", I get a wide range of files that I do not want; I believe this is because of the opening parenthesis is being ignored so any file with the word "from" is being returned.  I am not sure if regular expressions should be used, but even if so, I do not know how to use them in Windows search.

This will return thousands of files so I cannot feasibly go through the search results to determine if any files are included that should not be.  Therefore, the search must be precise, returning no files that do not match correctly, like what happens when I search and files with the word "from" are returned.

Thanks in advance for any help or suggestions.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi dageyra,
Windows 7 Search filters are definitely ... interesting to say the least! I share your frustration with how unfriendly this feature is in its current state.
Does the following return the results you are looking for?
filename::*foo (from thearclink_??_?).txt
Additional resources:
Windows Search Advanced Query Syntax
Windows Search wildcard operators
Hope this helps!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dageyraAuthor Commented:
Hello mark:

Thanks for the response, but unfortunately no.  I did remove the foo & .txt, I believe you left that in as an example?  However, using filename::*(from thearclink_??_?), I still get results that only have the word "from" instead of matching the entire string (from thearclink).  Now, it does return the results I am looking for, but it just returns results I am not looking for, and because there are so many, I need to only see what I want, not additional results.
dageyraAuthor Commented:
Ok, so that didn't work exactly, but got me on the right path.  The problem is that it pulled too many results, but as it turns out, the new Windows search has a "search ranking" column.  When I made this column visible, all of the extra results have a ranking of around 800, whereas the right results are like 990.  By sorting based on this column, I was able to select all of the right results very easily and processing those.  I have no idea what these numbers mean or how this works, but it worked great for my purposes.  Thanks again for your help.
My apologies for this not working as intended ... I really want it to work 100% for you.  :)
Using a set of test files and the exact search filter below (with quotes included), I was able to only return the files shown. If you're still running into false positives, can you provide a few more examples of results being returned and which ones you need excluded?
Search filter:
file="(dog cat_??_?).txt"
Test files:
(dog cat_en_2).txt         <--- correctly returned in search results
(dog cat_us_9).txt         <--- correctly returned in search results
cat1.txt                             <--- everything below this line excluded in search results
contents contain cat dog.txt
dog cat.txt
dog cat_22.txt
Search ranking:
Regarding the search ranking/scoring feature within Windows Search, see (excerpt below):

Search rank is on a 0 – 1000 scale, with a score of 1000 indicating an exact match on the entire file name. A search rank of 0 indicates that the file is not indexed. A grep search compares only filenames, while index-backed searches compares: File name: The name of the file (which may or may not include the extension).
Properties: Metadata specific to file type, such as the ‘artist’ for music files, ‘author’ for documents, or ‘tags’ for photos and videos.

Contents: The body of the file (for textual files).
If the name of the file matches or contains the search string, the file is given a higher ranking than one that matches only on metadata properties. The order in which a user enters terms in a search string also influences relevance: files matching search terms in the order specified in the search string are ranked higher than files matching search terms in a different order. Exact matches are ranked higher than substring matches. Certain properties are weighted more in the relevance algorithm.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.