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

Newbie:copy existing OneDrive folders and files to another OneDrive account.

Embarrassed to ask such a simple question but all the templates I've seen are triggered by the addition of new files in to a watched folder where as I just want to copy folders and exisitng files from a OneDrive account to another OneDrive account.

 

I'm sure its easy but a newbie.  The source OneDrive account is frozen so I can't "add" or change any files, i just need to copy everything across to my new active account.

 

thanks ! 

 

 

 

 

1 REPLY 1
Community Support Team
Community Support Team

Re: Newbie:copy existing OneDrive folders and files to another OneDrive account.

Hi @palmplex,

 

Do you want to copy files including folders from one OneDrive account to another OneDrive account?

 

I assume that you have a Directory A including multiple files (The Directory A may also have sub-folders) within your one OneDrive account, then you want to copy Directory A including multiple files into the folder of another OneDrive account.

 

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 (create a connection to this action with source OneDrive account), specify Folder, Include subfolders set to Yes.
  • Add a "Apply to each" action, input parameter set to output of "List files in folder" action.
  • Within "Apply to each" action, add a Condition, left input box set to IsFolder dynamic content of the "List files in folder" action, right input box set to true. within middle drop down, choose is equal to.

         Within "If/no" branch of Condition, add a "Get file content" action (create a connection to this action with source OneDrive account), File field set to Id dynamic content of the "List files in folder" action. Then add a "Create file" action (create a connection to this action with another OneDrive account), Folder Path field set to following formula:

replace(item()?['Path'],last(split(item()?['Path'],'/')),'')

File Name field set to DisplayName dynamic content of the "List files in folder" action, File Content field set to File content dynamic content of the "Get file content" action.

 

Image reference:2.JPG

 

3.JPG

The flow works successfully as below:4.JPG

 

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

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.

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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 (3,810)