​​​​How create a workflow to copy all documents from a document library to another document library?

Last Update: December 20, 2018

Apply for: SPARK Workflow for SharePoint 2013/2016 and Office 365

Suppose you have two document libraries named "DocLib1" and "DocLib2" created in the same site and you want to create a workflow to copy all documents from "DocLib1" to "DocLib2".
How create a workflow to copy all documents from a document library to another document library1.png
Here are the steps on how to do that.

  1. Create a new list workflow. For more details on how to create a list workflow, refer to Create a list workflow use case.
  2. Drag "For Each" and "Copy Item" activities ont​o the workflow canvas and drop it onto a​ design node as follows:
    How create a workflow to copy all documents from a document library to another document library2.png
    Note: A workflow variable of type integer should be created to store the value in when looping through each value in the source library.
  3. Configure the "For Each" activity as follows:
    How create a workflow to copy all documents from a document library to another document library3.png
  4. Configure the "Copy Item" activity as follows:
    How create a workflow to copy all documents from a document library to another document library4.png
  5. Publish the workflow by clicking on the Publish button in the workflow ribbon.
  6. Now go to "DocLib1" document library and run the workflow. For more details on how to run a list workflow, refer to Run a list workflow use case.
  7. Go to "DocLib2" you will see that all documents have been copied from "DocLib1" to "DocLib2".