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

Announcements

News and Announcements icon
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
    332 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard