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 / Extracting a file name...
Power Automate
Answered

Extracting a file name string during a file copy flow

(0) ShareShare
ReportReport
Posted on by
Dear experts,

I am very new to ms flow and have got a use case to complete.
Every week we get a file on our share point. This file name ia like "test-20190322.xlsx" where 20190322 is today's date. My task is to copy the file from test-20190322.xlsx to test.xlsx. this will be a daily task.i will be highly thankful if u can get a solution of it. Have spent like two days on this, but unable to achieve this.

Many thanks un advance,
Shubhasis
Categories:
I have the same question (0)
  • Verified answer
    ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @Anonymous :

    Here is an example that should help you.

     

    In my example, I am assuming that the only files that go into the library are the ones that you want to process.   If that is not the case, you'll need to do some filtering or use a condition.

     

    I have two expressions.  First, I have an expression that strips the date part out of the file name when I initialize the variable:

    substring(triggerBody()?['{FilenameWithExtension}'],0,indexOf(triggerBody()?['{FilenameWithExtension}'],'-'))

     

    Please note that I selected Filename with Extension from Dynamic properties when creating the expression.

     

    When creating the file, I use the following expression to add the extension to the file name stored in my variable:

    concat(variables('varFileName'),'.xlsx')

     

    ChangeFileName.jpg

     

    If this addresses your issue, please mark you post as Solved.

    If you like my solution, please give it a Thumbs Up.

     

    Scott

  • Community Power Platform Member Profile Picture
    on at

    Thanks, for the help.

     

    However, I found one other way to do it. I am renaming copying file from test-(date in yyyymmdd) to test. This will keep my old copies as well as will rename the new file with date to test .

     

    Thanks!

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard