web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Look for file names in...
Power Automate
Answered

Look for file names in a folder

(0) ShareShare
ReportReport
Posted on by 14
I need to look for file names using a regular expression (e.g. Invoice*.xlsx) within a folder. If any matches are found, I want to proceed; if not, I want to terminate the power automate desktop flow.
 
I came across the 'If file exists' action, but it requires a fixed file name as the input.
 
Has anyone figured out a solution for this?
 
Thanks in advance!
I have the same question (0)
  • Verified answer
    Infamous_Let Profile Picture
    330 on at
    You can do the following to search for files by pattern in Power Automate Desktop.

    Start by using the "Get files in folder" action to grab all files from the folder where you want to search.
    Next, use a "For Each" action to loop through the list of files one by one.
    Inside the loop, add a "Matches Text" action to check if the file name matches your pattern, such as Invoice.*\.xlsx.
    If a match is found, exit the loop and continue with your flow.
    If the loop finishes without finding a match, you can use the "Terminate flow" action to stop the process.
  • NT-15101604-0 Profile Picture
    14 on at
    Thank you for getting back to me. That should definitely serve as a workaround.
    I also found a way to address it as an exception when 'Get files from folder' generates an error if no files are present.
    Thanks again!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard