I have a weird requirement. I have a document library that has a folder [test1] inside that folder is document1 and document2. I need to run a workflow on the folder and see if any document comes back with '2' in the name and if it doesn't, send out an email. Any suggestions on how I would go about this is appreciated!
You can't run a workflow on a folder. You can run it on the list, or the site. I'd recommend doing a site workflow. It's a 2 step process.
For part 1, use the Query List action to query the library this folder is in. Make sure to check the box for "Recursive". This makes it search within folder. Set your criteria to look for any documents where the Name contains 2. (or does not contain 2. I didn't exactly understand your conditions if you want to send out the notification if has 2 or doesn't have 2). I would return the ID field and create a collection variable to store it.
For part 2, once you have the collection of ID's, you now need to determine if the document is in the specific folder. Use a For Each to loop through the collection. For each ID, query the list again for that document, and pull back the URL Path of the document. You can use a Regular Expression action to remove the file name to get just the path. Then evaluate that url to see if it matches the path of your folder. If it does, then you can send out your email.