You need to copy files from one SharePoint document library to another on a regular basis. Doing this manually takes time and risks errors. Power Automate can handle this task automatically using a cloud flow. This article explains how to build a reliable workflow that copies files based on a schedule or trigger.
The built-in SharePoint connector in Power Automate includes actions to copy, move, and delete files. The key challenge is handling file metadata and folder structures during the copy process. This workflow uses the Copy file action combined with a simple loop to process each file.
This guide covers the complete setup from trigger selection to testing the flow. You will learn how to handle common issues like duplicate file names and large file sizes. By the end, you can run the flow daily or weekly without manual intervention.
Key Takeaways: Automating File Copies Between SharePoint Libraries
- Power Automate > Instant cloud flow > SharePoint trigger: Start the flow manually or on a schedule using the Recurrence trigger.
- SharePoint connector > Get files (properties only): Retrieves a list of files from the source library without downloading content.
- Apply to each > Copy file action: Loops through each file and copies it to the destination library, preserving folder structure if needed.
How the Power Automate Copy File Workflow Works
Power Automate uses connectors to interact with SharePoint. The Copy file action is part of the SharePoint connector. It copies a file from one location to another within the same site or across sites. The action requires three inputs: the source file identifier, the destination library name, and the destination folder path.
The flow uses a trigger to start. You have two main options: a manual trigger or a scheduled recurrence. For a scheduled copy, use the Recurrence trigger with a frequency of days, hours, or minutes. For a manual trigger, use the Instant cloud flow option and select Manually trigger a flow.
Prerequisites
Before building the flow, confirm you have the following:
- Power Automate license (included with Microsoft 365 Business Basic or higher)
- Access to both the source and destination SharePoint sites
- At least Contribute permission on both libraries
- Destination library already created
Building the Flow to Copy Files Between Libraries
This flow copies all files from one library to another. It runs on a schedule you define. Follow these steps exactly to avoid errors.
- Create a new scheduled cloud flow
Go to Power Automate > Create > Scheduled cloud flow. Name the flow, set the recurrence frequency (for example, every 1 day), and set the start date and time. Click Create. - Add the SharePoint Get files action
Click + New step. Search for SharePoint and select the Get files (properties only) action. This action retrieves file metadata without downloading content. Set the Site Address to your source site URL. Set the Library Name to the source library name. - Add an Apply to each loop
Click + New step. Search for Apply to each. In the Select an output from previous steps field, choose the value dynamic content from the Get files action. This tells the loop to process each file one by one. - Add the Copy file action inside the loop
Inside the Apply to each block, click Add an action. Search for SharePoint and select the Copy file action. Configure the following fields:
Source file: Select the Id dynamic content from the Get files action.
Destination Site Address: Enter the destination site URL.
Destination Library Name: Enter the destination library name.
Destination Folder: Leave blank to copy to the root. To copy to a specific folder, enter the folder path relative to the library (for example, /Archive).
Overwrite: Select Yes if you want to replace existing files with the same name. Select No to skip duplicates. - Save and test the flow
Click Save at the top. Click Test and choose Manually or Automatically. Run the test with a few files in the source library. Check the destination library to confirm the files appear.
Handling Common Issues During File Copy
Even with a correct flow, you may encounter problems. Here are the most frequent issues and how to resolve them.
File Already Exists in Destination
If the destination library already contains a file with the same name, the flow may fail. In the Copy file action, set Overwrite to Yes to replace the file. If you want to keep both versions, rename the source file before copying. You can use the Rename file action in the loop.
Large Files Cause Timeout
Power Automate has a 30-minute timeout for actions. Files larger than 250 MB may cause the flow to fail. For large files, use the Move file action instead, which works better with large content. Alternatively, split the copy into multiple runs by filtering files by size using the Filter array action.
Files in Subfolders Are Not Copied
The Get files action by default retrieves only files at the root level. To include subfolders, use the Get files (properties only) action with the Include subfolders option set to Yes. Then, in the Copy file action, set the Destination Folder to the dynamic content Path from the Get files action. This preserves the folder structure.
| Item | Scheduled Cloud Flow | Instant Cloud Flow |
|---|---|---|
| Trigger type | Recurrence timer | Manual button |
| Best use case | Daily or weekly backups | On-demand copy after a meeting |
| File size limit | 250 MB per file | 250 MB per file |
| Overwrite control | Yes or No per action | Yes or No per action |
| Subfolder support | Yes with Include subfolders | Yes with Include subfolders |
This flow works for both scheduled and manual triggers. Choose the trigger that fits your business process. For example, run the flow every night to copy reports to an archive library.
You can now build a Power Automate flow that copies files between SharePoint libraries automatically. Start by testing the flow with a small set of files to verify the folder structure and overwrite behavior. For advanced scenarios, add a condition to copy only files modified in the last 24 hours using the Modified column and the Filter array action.