cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ludwig
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
Super User
Super User

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!

Proud to be a Flownaut!


ludwig
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

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.
Brian13 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.

Super User
Super User

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!

Proud to be a Flownaut!


Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (6,127)