cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shubhasismathur
Level: Power Up

Extracting a file name string during a file copy flow

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
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Extracting a file name string during a file copy flow

@Shubhasismathur :

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

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
2 REPLIES 2
Super User
Super User

Re: Extracting a file name string during a file copy flow

@Shubhasismathur :

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

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Shubhasismathur
Level: Power Up

Re: Extracting a file name string during a file copy flow

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!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 359 members 5,065 guests
Please welcome our newest community members: