Find a File by Name in the Front Finder Window

I want to create a macro in such a way:

Find some text in the current folder -- if the file is found, then execute macro A if not, then execute macro B.

Hey Hiren,

Please clarify your requirements.

Are you searching for a file name? Or are you searching for text inside the files in a folder?

-Chris

currently, I am only looking to search for a file name, But would also like to know how to search text inside the files.

Take a look at Textcavator 2020. It can look through just certain files in a directory for specific text in the files.