Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Copy files between SharePoint libraries (Power Automate)

Posted on July 1, 2020January 12, 2022 by Tom

Copy files one by one can be painful if you’ve got a lot of them or if you need to do it regularly, there has to be a way how to automate this with Power Automate.


Let’s build a simple workflow to copy all files from one location to another on user request. That means we want to start from Instant flow using Manually trigger flow trigger.

Add New step: ‘Get files (properties only)’ and select the source of the files.

Add New step: ‘Copy file’. Select the source site, and use the ‘Identifier’ output from ‘Get files (properties only)’ as the ‘File to Copy’.

Select ‘Destination Site Address’ and for the ‘Destination folder’ fields. Instead of using dynamic content in the field click on the folder icon on the right side to display selection of all available libraries on the destination site. Also select what should happen it file already exists on the destination site.

copy files power automate
copy files power automate

Now you can find it under My flows and run it by pressing the Play button.

copy files power automate

If your document library contains also folder structure, you might need to add one more condition into the Power Automate flow to copy the folders together with the files, and even keep them synchronised in the future.

You can also copy files between multiple libraries in a single flow with a simple configuration list, or copy the created and modified information.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

33 thoughts on “Copy files between SharePoint libraries (Power Automate)”

  1. Angus says:
    June 23, 2021 at 5:49 am

    This is great except it copied all the files and nested folders from one site and placed them all in the root folder of the destination. Is it possible to maintain the folder structure during the copy?

    Reply
    1. Tom says:
      June 27, 2021 at 9:11 pm

      Hello Angus,
      I think you’ll need to go folder by folder, ‘Get files’ from one folder, ‘Copy file’ to the same folder on the other site. And repeat that for all the folders.

      Reply
    2. Tom says:
      July 7, 2021 at 7:15 pm

      Hello Angus,
      I played with the flow a bit and found a solution for the folder structure: https://tomriha.com/how-to-copy-sharepoint-files-including-folder-structure-in-power-automate/

      Reply
  2. Lucas says:
    August 26, 2021 at 5:00 pm

    Hey guys.
    My work team changes the file title with the current date at the end.
    How do I copy the file that changes the title every time?

    Reply
    1. Tom says:
      September 1, 2021 at 7:30 pm

      Hello Lucas,
      I believe the solution would be the same, if you build a flow to take all the files and copy them to another location then the file name doesn’t matter, it’ll create a file with the same name, with the date at the end, in the target location.

      Reply
  3. Josef says:
    October 5, 2021 at 5:04 pm

    Great article Tom! I was looking for a long time for a way to copy SharePoint files (or actually SharePoint pages from the Site pages library) with Flow. This works great (for the library name, just enter the library GUID) πŸ™‚

    Reply
  4. UB says:
    October 10, 2021 at 12:52 pm

    Thanks for sharing. I have a question, is there a way to retain the date created and modified dates from the original library?

    Reply
    1. Tom says:
      October 13, 2021 at 8:28 pm

      Hello UB,
      I would recommend to create a separate SharePoint columns for the information as described in the latest post: https://tomriha.com/copy-files-including-created-and-modified-date-with-power-automate/.

      Reply
  5. Harsh Deshmane says:
    January 20, 2022 at 3:48 am

    Hi,
    Is there a way to trigger the copying when there is any change in the source folder ?
    thanks

    Reply
    1. Tom says:
      January 23, 2022 at 5:33 pm

      Hello Harsh,
      yes, it is. I wrote a blog post about such flow here: https://tomriha.com/synchronise-sharepoint-libraries-with-folder-structure-in-power-automate/, all you have to add is to select a specific folder in the trigger.

      Reply
  6. leonardo says:
    January 25, 2022 at 1:42 am

    I keep getting a URL not valid error in the target tenant. I gave bi-lateral permissions to each tenant as well and nothing. is there another step in in there that I am missing?

    Reply
    1. Tom says:
      January 29, 2022 at 6:58 pm

      Hello Leonardo,
      Power Automate flows work only in a single tenant, you can’t use it to copy files between multiple tenants.

      Reply
  7. kurt says:
    April 1, 2022 at 10:26 pm

    Thanks, Tom for the excellent articles – I’m just getting started, and your posts are helping me quite a bit.
    I think there have been some changes since you originally wrote this article, so here’s what I’ve learned from working on this. My use case is to copy a multi-level folder structure (with files) from one SharePoint Library to one in a different SharePoint site.

    First, in your ‘Get Files (properties only)’ step, if you choose ‘Include Nested Items’ = No, then you’ll only get the top level folder (both files and folders), and no longer any need to write the condition statement that you show in your article: https://tomriha.com/how-to-copy-sharepoint-files-including-folder-structure-in-power-automate/

    Second, using ‘Copy file’ on all items, I was getting a ‘File Not Found’ error on the folders. It still worked (copied all files and folders including subfolders), but just reported that it failed every time.

    The solution was to add a condition inside the ‘Apply to each’ loop: IsFolder is equal to true, and use Copy folder if true, else Copy file.

    This works great with no errors, copying the full tree.

    Thanks again for your great content. Keep it coming!

    Reply
    1. Tom says:
      April 6, 2022 at 10:12 pm

      Hello kurt,
      thank you for sharing your solution, I totally forgot about the possibility to not include the nested items, that simplifies the solution a lot.

      Reply
  8. Pruthvi says:
    April 13, 2022 at 8:34 am

    Hello I had used the same steps to get the work done but my flow is getting failed with the error stating ” response not in json format” but the files are getting moved can anyone help, thanks in advance.

    Reply
    1. Tom says:
      April 13, 2022 at 2:46 pm

      Hello Pruthvi,
      I’ve seen the error already a few times and I have no idea how to handle it, it says that SharePoint sent back an unexpected response, but it copies the file anyway. I’d probably ignore it if you’re using the flow for a one-time copy.

      Reply
  9. Mridul says:
    June 6, 2022 at 12:29 pm

    Hi Tom,
    I have followed the steps, but in my case i want to copy the Pages from Site Pages of one sharepoint site to another sharepoint site. I tried but i am getting an error that states ‘the query cannot be completed because the number of look up columns it contains exceed the lookup column threshold’. I tried to increase the threshold but in the library setting of site pages i wasn’t able to get the pagination option, however, the threshold and pagination option does appear in Document library settings. Would be great if you can help me out. Look forward to your email.

    Reply
    1. Tom says:
      June 12, 2022 at 8:41 pm

      Hello Mridul,
      Google returned this article: https://www.c-sharpcorner.com/article/msflow-lookup-columns-exceed-the-threshold-enforced-by-adminstrator/

      Reply
  10. Jennifer says:
    June 8, 2022 at 6:26 pm

    This works great, however, it stops at 100 files. It won’t go beyond that.

    Reply
    1. Tom says:
      June 12, 2022 at 8:48 pm

      Hello Jennifer,
      it’s because the ‘Get items’ and ‘Get files’ actions have a limit of 100 items (https://tomriha.com/how-to-get-over-100-items-limit-with-the-get-items-in-power-automate/). Even though the ‘Top Count’ says ‘Default = all’ in reality it’s ‘Default = 100’. Just put a higher number in there.

      Reply
  11. Edgar says:
    June 23, 2022 at 1:17 pm

    Hello, is it possible to copy the files with their associated metadata? And not just the file itself..

    Reply
    1. Tom says:
      July 3, 2022 at 11:43 am

      Hello Edgar,
      if the metadata is not included then you can use ‘Update file properties’ to compy the metadata.

      Reply
      1. Mike says:
        July 5, 2022 at 9:08 am

        Hello Tom, Edgar,
        I’m using “Update file properties” to update metadata after the copy file, it works great but the issue is it generates 2 file versions in history…Since we are using this process for DMS (safe source of important documents), it causes issues in audits we have on file generation…I could not get around it.
        If I’m using SP.MoveCopyUtil.CopyFileByPath() in a REST API call, file get copied but history is deleted.
        If I’m using CreateCopyJobs in a REST API call, file gets copied but it’s also copying source version history….
        I don’t know if you came around this? Thanks

        Reply
        1. Tom says:
          July 12, 2022 at 4:38 pm

          Hello Mike,
          you could try to update the properties using an HTTP request as described here: https://tomriha.com/update-sharepoint-column-without-new-item-version-in-power-automate/

          Reply
  12. Cheryl Lee says:
    October 5, 2022 at 5:23 pm

    Hi,
    I may have missed the comments. My flow works and it does copy files from one sharepoint folder to the other. All the files will keep their names.

    However, in the the destination, all the version history disappears. Is there a way to retain it?

    Reply
    1. Tom says:
      October 14, 2022 at 10:23 am

      Hello Cheryl,
      you can’t copy the old version history of the original file, it takes only the currently available version. But it’s possible to update the destination file instead of replacing it during the copy action as explained here: https://tomriha.com/how-to-update-not-replace-an-existing-file-in-power-automate/

      Reply
  13. schezelle says:
    August 11, 2023 at 6:05 pm

    Hi Tom, I’m trying to copy files with specific column information from one SharePoint library to another, but nothing I’ve tried so far works. Do you have a solution for getting power automate to only copy the files that have specific column data?

    Reply
    1. Tom says:
      September 7, 2023 at 12:13 pm

      Hello Schezelle,
      take a look on the filtering articles, you can filter only the desired files before you copy them: https://tomriha.com/category/filters/

      Reply
  14. Mike says:
    September 14, 2023 at 5:55 pm

    Is there a way to do this with selected files. I only want to copy the selected files from one library to another library.

    Reply
    1. Tom says:
      September 30, 2023 at 10:30 pm

      Hello Mike,
      yes, you can filter the files to copy using filter in the ‘Get files…’ action: https://tomriha.com/category/filters/

      Reply
  15. yuki says:
    April 18, 2024 at 12:40 am

    Hello.
    Do you know how to copy the Document Library body of a SharePoint to another SharePoint?
    The contents do not need to be copied.

    Reply
    1. Tom says:
      May 25, 2024 at 9:35 pm

      Hello yuki,
      I believe that document libraries can’t be copied, you’ll have to recreate the whole library, either manually or with a script/flow, adding the columns one by one.

      Reply
  16. It Support says:
    June 20, 2024 at 9:50 am

    Hello There,

    Could you please help me with how to exclude a specific folder (with files) to be copied?

    example:
    General > Main Folder
    Folder 1 > Sub folder
    Folder 2 > Sub folder >> I want this entire folder not to be copied in my power automate flow.

    Thank you in advance.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes