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 / How to check if filena...
Power Automate
Unanswered

How to check if filename excist in folder and move to different

(0) ShareShare
ReportReport
Posted on by 75

Hello,

 

I want to make a flow, that says:

"If i move a file to a folder, and there already is a file containing part of the name, move the old file to a different folder"

But i am having trouble with doing the containing. All the files is named by their name + det approval request date, and therefore it should only be the documentname (and not the date) that is identical.

EmilieNybo1_1-1668418012580.png

 

I have tried some different things, also considered to make a seperate flow, but it does not seem to work for me

 

Is anyone having some ideas of how i should build this?

 

Thank you in advance!

Emilie

 

 

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    You can try the following Filter Query:

     

    For Starts with:

     

    startswith(Column, 'value')
    
    Example:
    
    startswith(FileLeafRef, 'ABC123')

     

    For Contains:

     

    substringof('value', Column)
    
    Example:
    
    substringof('ABC', FileLeafRef)

     

  • EmilieNybo1 Profile Picture
    75 on at

    Thank you for your answer @grantjenkins 

     

    I tried to put in:

    substringof(outputs('Hent_filmetadata')?['body/Name'], FileLeafRef)
    but it says it is invalid, i need the name to be dynamic, therefore the text as "value" 🙂
     
    Do you know if i should do anything specific, when i want the experession to be dynamic?
  • grantjenkins Profile Picture
    11,063 Moderator on at

    You need to include your dynamic text inside quotes in the Filter Query. Something like the following.

     

    grantjenkins_0-1668433144921.png

     

    However, I'm not sure if substringof will work in you case after looking at it more closely at it will see if your FileLeafRef contains your dynamic expression value. But you want it the other way around.

     

    Another option is to return all files initially, then use a Filter array which has a Contains option.

  • EmilieNybo1 Profile Picture
    75 on at

    Thank you! I am still very new to Power Automate, so i am trying to learn the different expressions.

     

    Unfortunatly subspringof does not return my desired output, nor does

    EmilieNybo1_0-1668434301888.png

    Which is what i assume you mean by "Return all files initially" ?

     

    Best Regards,

    Emilie

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Sorry for the late reply. You can return all files using Get files, then use a Filter array using the contains option as shown below:

     

    grantjenkins_0-1668947249223.png

     

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 458

#2
Vish WR Profile Picture

Vish WR 345

#3
David_MA Profile Picture

David_MA 261 Super User 2026 Season 1

Last 30 days Overall leaderboard