cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NickFoxall
Frequent Visitor

Renaming a file based on an existing filename.

Hi all,

 

This is something that sounds so simple but i've really struggled in finding an answer. 

 

I received weekly vehicle reports from a set email address, I have a flow set up to save the email attachments in a shared Sharepoint folder. The files come through like this (where the vehicle reg number for example is ABC123):

 

ABC123 - Inspection Report.pdf

 

I'd like to add into my flow to rename the file simply as ABC123.pdf so that I can link it in other flows and automatically email the report to the end user based on a sharepoint list reg numbers and users. 

 

Thanks in advance and I'm hoping this is as simple as it sounds!

 

Nick

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
grantjenkins
Community Champion
Community Champion

If you knew that all the attachments were going to be the exact same format and all PDF, then you could do the following. Note the expression used is:

 

concat(slice(items('Apply_to_each')?['name'], 0, indexOf(items('Apply_to_each')?['name'], ' ')), '.pdf')

 

grantjenkins_1-1669432286579.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

2 REPLIES 2
grantjenkins
Community Champion
Community Champion

If you knew that all the attachments were going to be the exact same format and all PDF, then you could do the following. Note the expression used is:

 

concat(slice(items('Apply_to_each')?['name'], 0, indexOf(items('Apply_to_each')?['name'], ' ')), '.pdf')

 

grantjenkins_1-1669432286579.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Thanks for this, the coding used in the compose section. Has it got a name as would love to learn more about the function etc.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,642)