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 / Using a wildcard in 'I...
Power Automate
Unanswered

Using a wildcard in 'If file exists'

(0) ShareShare
ReportReport
Posted on by 4

I am trying to run a task that looks for a file in a folder, if it is there it copies it, moves it, and sends an email. 

However the file name changes to have date and time on it. So it will never be the same. And sometimes the previous days date is placed today, so I can not look for the file with today's date. 

I can not get the * to work inside of the if file exists task. Is there any other way around this? I tried using Get files in folder and then pulling that in, but if file exists will also not work with a variable, it must be a file. 

 

Thanks in advance for any help. 

I have the same question (0)
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    I guess you can use Get files in folder, then use a regular If condition to check if the list is empty or not.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Is the folder otherwise empty?  If so, I would go with @Henrik_M 's option.

     

    If the folder is not otherwise empty, then you have to create a rule that differentiates between the last available file and the one you are looking for, because Get Files will always bring all files in.

  • Destro3m Profile Picture
    4 on at

    No, there can be multiple files (ones that I do and don't want to move) in each folder. That was where I was running into problems. 

    Here is what I am working on:

     

    Destro3m_1-1640209317476.png

     

    So essentially I am reading an excel sheet that as the file name in one field (without the added dates etc.) So just TestFileName

    then the next column is where to copy the file, followed by where to archive/move file, and finally email to send notification to. 

     

    However how it is setup in this snippet, it will always send the email saying the file was moved even if there was no file there to move. So this is where I need something to basically say "is there a file there to move" then if there is not, it will just move on to the next line. 

     

    If file exists would be perfect, but it only works with file, you can not use a variable to read it in, and you can not use a wild card. I tried using it with %ExcelRow['source']%/%ExcelRow['FileName']%* but no luck. 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Why can't you use a variable on If file exists?

    MichaelAnnis_0-1640210331345.png

     

    Is it possible you are just missing the extension, in my case .xlsx?

  • Destro3m Profile Picture
    4 on at

    The file path is also a variable. It is being pulled from the excel data as well.

    so when I set it up it looks like this:

     

    Destro3m_0-1640812217150.png

     

     

    And when it is done like that, it does not see the file, even when it is in the folder.

    I have also tried to put the wildcard at the end as *.* as well, and nothing.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 484

#2
11manish Profile Picture

11manish 282

#3
David_MA Profile Picture

David_MA 280 Super User 2026 Season 1

Last 30 days Overall leaderboard