cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Rename file with flow on OneDrive

Hi,

I have a couple of files created on one drive that all have an ending ... .pdf

Example: File1.pdf, File2.pdf, etc.

How can I get rid of the .pdf from the file name for all of my files at once?

Best regards,

Ludwig

5 REPLIES 5
faustocapellanj
Memorable Member
Memorable Member

Hi @Anonymous

 

Is there any particular reason why you want to remove the file extension?

 

Regards,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Anonymous
Not applicable

Hi,

Yes, my files have the vendor ID included.

Example: V123, V456

I want to use this info in a subsequent step to search for the correct vendor contact.

This does not work if the files are saved as

V123.pdf or V456.pdf

Best regards,

Ludwig

v-xida-msft
Community Support
Community Support

Hi @Anonymous,

 

Do you want to search correct vendor contact based on vendor ID, such as, V123, V456, etc?

Do you want to remove the extension name of the PDF file and store them as V123 or V456 in your OneDrive folder?

Further, could you please show a screenshot of your flow's configuration?

 

I think it is not necessary to remove the extension name of PDF files and store them as V123 or V456 in your OneDrive folder for searching correct vendor contact. In addition, if you remove the extension name of these files, the Content type of these files would be changed.

 

You could consider take a try to get the file name which doesn't include extension name using Microsoft Flow, such as, V123, V456, etc. I have created some PDF files within my OneDrive folder, the screenshot as below:2.JPG

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "List files in folder" action of OneDrive connector, specify Folder.
  • Add a "Apply to each", input parameter set to output of "List files in folder" action.
  • Within "Apply to each", add a "Compose" action, Inputs set to following formula:

 

first(split(items('Apply_to_each')?['DisplayName'],'.'))

Note: The above formula within Compose action is used to get the file name which doesn't include extension name.

 

 

Image reference:3.JPG

The flow works successfully as below:4.JPG

 

5.JPG

 

In addition, renaming file action is not supported in OneDrive connector, if you want to rename files on your OneDrive folder, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "List files in folder" action, specify Folder.
  • Add a "Apply to each" action, input parameter set to output of "List files in folder" action.
  • Within "Apply to each" action, add a "Compose" action, Inputs set to following formula:

 

first(split(items('Apply_to_each')?['DisplayName'],'.'))

 

    Add a "Get file content" action, File field set to Id dynamic content of "List files in folder" action. Then add a "Create file" action, specify Folder Path, File Name field set to output of "Compose" action, File Content field set to File content dynamic content of "Get file content" action.

 

Add a "Delete file" action, File field set to Id dynamic content of "List files in folder" action.

 

Image reference:

6.JPG

 

7.JPG

The flow works successfully as below:8.JPG

 

9.JPG

 

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thank you very much for taking the time to explain how to separate a file name and its extension - works a treat in a slightly different context.

Hi @Brian13

 

I'm glad the solution helped you achieve your solution.

 

Regards,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,916)