How to Copy Files in SharePoint Using Microsoft Flow

Microsoft Flow has made it easier to copy files from one SharePoint site to another. It has provided actions such as creating and copying a file. This has made it easier for users to sync files from one site to another. Here, we will try to copy files from one site to another. There are two ways to copy the folder structure of the file: copy the whole main folder and copy the file inside the folder it belongs to.

Example of Source Documentary Library

This is the document library from the source site. This is the library for the files that will be copied.

Example of Destination Document Library

This is the destination document library where we will copy the files.

Copying a File

The flow copies file by file which lessens the errors that might occur because it is modified simultaneously. You need to have the folders in the library ready when copying. If the folders do not exist in the library, this may cause an error.

It is easy to copy files using Flows, but retaining the file folder directory structure needs more actions. Let’s do a simple example of copying files.

Copy the Reports Part 1.docx file from Source Site. The folder structure of the file is Documents.

This is how it looks when using the Copy file action.

For Current Site Address, write the site address where the file to be copied is located.

For File to Copy, select the file path by clicking the folder icon. The drop-down below will pop up.

Select the next (>) icon of the destination library and select the file.

For Destination Site Address, add the site address to where the file should be copied.

For Destination Folder, The drop-down below will show up when you click the folder icon.

Select the path of the folder destination. Note that if the file is inside a folder, you need to specify the exact folder path.

If there is an existing file in the destination path, you’ll be asked to choose any of the three options: copy with a new name, fail this action, and replace.

Choose Replace if you want to copy if there are any changes applied to the source document.

The output to this action should look like the picture below.

Copying Files, Retaining its Folder Directory Structure

Files can be copied through copying the folder or creating the folders dynamically. When copying the whole folder, the MS Flow copies the whole folder as many times as the number of the files being uploaded to that folder because the Microsoft Flows does not have an action that says, “When a folder is created action.”

Here’s an example of copying files by folder.

This is an example of a file inside a folder. Copy the file and retain its folder structure.

For Current Site Address, write the site address where the folder to be copied is located.

For File to Copy, select the folder path by clicking the folder icon, the drop-down below will show up.

Select the next (>) icon of the destination library.

Select the folder to be copied.

For Destination Site Address, add the site address to where the file should be copied.

For Destination Folder, the drop-down below will show up when you click the folder icon.

Select the exact path of the folder destination.

There are choices given as to what you want to do if there is an existing file in the destination path. Simply choose Replace.

There you go. We hope we helped you in easily copying files in SharePoint using MS Flows. Don’t forget to share this article on your social media handles.

 

Add a Comment

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