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 / ends with condition do...
Power Automate
Suggested Answer

ends with condition doesn't seem to work on "Filename" or "Filepath" in my flow

(1) ShareShare
ReportReport
Posted on by 2
Hi,
 
I'm building a flow on which I want a certain number of steps to take place when a new file is saved to a specific directory IF this file a pdf file (see the screenshot below).
 
I tried using a condition, checking if "File name ends with .pdf" to no avail : the flow branches to false.
 
I tried "pdf", ".pdf", I tried it with a Word document, and ".docx" : still not working.
 
I built a small flow just to check the names and paths of the files were captured correctly, and it is the case : when I put a new pdf file in the directory, I receive an email with the complete file name including its ".pdf" extention.
 
I am at a loss here, thanks for your help!
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    14,126 Super User 2026 Season 1 on at
    I find this works better when you use an expression and then evaluate if the expression returns true or false. For example:
    The expression on the left is this: endsWith(outputs('Get_file_metadata_using_path')?['body/Name'],'.pdf') 
     
    Just update the expression with the dynamic value that contains the filename.
  • PF-20031602-0 Profile Picture
    2 on at
    Thanks @David_MA for your proposal.
     
    Just tried it, using "endWith", and also "contains", still no luck.
     
    I have a feeling I'm running out of solutions, and still don't see why this is not working.
  • Ellis Karim Profile Picture
    12,008 Super User 2026 Season 1 on at
    Hi 
     
    Can you try the following expression:
     
     
    triggerOutputs()?['headers']?['x-ms-file-name']
     
     
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

  • Suggested answer
    w.p Profile Picture
    8,345 Super User 2026 Season 1 on at
    Removing the '-encoded' suffix from the default dynamic value should work or use Ellis Karim's expression.
     
    @{triggerOutputs()?['headers/x-ms-file-name']}
     
     

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 612

#2
Valantis Profile Picture

Valantis 344

#3
11manish Profile Picture

11manish 326

Last 30 days Overall leaderboard