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

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
Highlighted
Memorable Member
Memorable Member

Re: Rename file with flow on OneDrive

Hi @ludwig

 

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!
Highlighted
Frequent Visitor

Re: Rename file with flow on OneDrive

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

Highlighted
Community Support
Community Support

Re: Rename file with flow on OneDrive

Hi @ludwig,

 

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.
Highlighted
Helper I
Helper I

y Re: Rename file with flow on OneDrive

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.

Highlighted
Memorable Member
Memorable Member

Re: y Re: Rename file with flow on OneDrive

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
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (8,227)