cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DemoMan
Helper I
Helper I

Copy a library folder structure to a newly created library

Hi everyone, hope everyone is doing well and staying safe.

 

Here's my issue.

 

I'm trying to automate creating a document library and populating this library based on a folder structure.

I create the library with a HTTP Call to SP and that works well.

but when I go to copy the folders I want into that new library I get error "

 

even though the library was created successfully.

 

screenshots belowAutomateProject1.JPG

 

AutomateProject2.JPG

 

AutomateProject3.JPG

 

I get the same result when I use "Copy Folder" instead of "Copy File".

Is there a better way to copy a folder structure from a library to another dynamically or I'm missing something with this method?

 

Thanks in advance

8 REPLIES 8
DeepakS
Super User
Super User

Hi @DemoMan 

Try after adding "/" to Destination folder , as below:

filesave.jpg

Regards

Hi @DeepakS  Thanks for the quick reply,

 

I seem to be getting the same error:

 

AutomateProject4.JPG

 what do you think?

v-bacao-msft
Community Support
Community Support

 

Hi @DemoMan ,

 

Please try the following configuration.

 

  • Use List folder action to get the folders and files in the root folder.
  • Determine whether the current item is a folder or a file, and then use Copy folder and Copy file action to process separately.
  • Enter "/NewLibraryName" in the Destination Folder.

 

An error will be encountered when Flow is executed. The error will be encountered when moving the Forms folder. This error can be ignored. Because each library has a Form folder by default, there is a conflict here.

 

Image reference:

Spoiler
167.PNG

 

Hope this helps.

 

Best Regards,

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

Hi @v-bacao-msft 

 

Thanks for your reply,

 

The flow ends up timing out, the http request creates the library but it doesn't add the folders in it.

When I create the library manually and hard code the library name into the flow, it works.

is there really not a way to copy/move folders/files to a URL created dynamically?

 

Hi @DemoMan ,

 

You only need to fill a correct Library Name in Destination Folder. Like /LibraryName.

 

Since that you have used Parse JSON to parse the HTTP response, you could get the correct library Name.

 

Best Regards,

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

Hi @v-bacao-msft 

 

Thanks for your reply.

 

I tried using the library name out of the JSON parse and I got the same result.

 

Hi @DemoMan ,

 

Please try to use Get folder metadata action to get the path of the newly created Library root directory to verify the existence of Folder.

18.PNG

I think the method I provided can Copy a library folder structure to a library. It seems that the problem is with your newly created library.

 

Best Regards,

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

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (70,194)