SharePoint copy folder/docs but selective copy...

Dave Amos 0 Reputation points
2024-06-06T10:48:28.7833333+00:00

We have a large SharePoint document folder, and want t replicate some folders to a new site, however the folder structure for example is

Parent Folder A

Sub Folder 1

Files

Sub Folder 2

Files

Sub Folder 3

Files

Parent Folder B

Sub Folder 1

Files

Sub Folder 2

Files

Sub Folder 3

Files

We want to replicate this to the new site, but only want the following folder/and files (The sub folder names are consistent between all parent folders)

Parent Folder A

Sub Folder 3

Files

Parent Folder B

Sub Folder 3

Files

Is their a way to do this type of recursive copy, with some filtering on folder name via PowerShell?

I have found some move scripts that could do this with a bit of tweaking but wondered it there is a safe way to do this, without having to resort to someone recreating it/or copying the entire lot over/ then deleting the unwanted sub folders etc...

Should note this is a onetime hit, as moving forwards, users will create the folders manually/and files in the sub folders, will be selected files, rather then the full selection due to the SharePoint audience for these files

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,783 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,025 questions
SharePoint Workflow
SharePoint Workflow
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Workflow: An orchestrated and repeatable pattern of business activity, enabling data transformation, service provision, and information retrieval.
598 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ling Zhou_MSFT 18,020 Reputation points Microsoft Vendor
    2024-06-07T03:07:16.8533333+00:00

    Hi @Dave Amos,

    Thank you for posting in this community.

    We can use power automate to create a workflow.

    1. First, we need to create all the parent folders in the target document library.
    2. Go back to your source document library and select Create Workflow.

    User's image

    User's image

    1. Select Create a manually triggered workflow.

    User's image

    User's image

    1. Switch to classic design mode.

    User's image

    1. Add a copy folder action, select the source folder and the target folder. In my case it is copying folder 3 in Folder A in Lib to Folder A in Lib2.

    User's image

    1. Add your other migration actions in turn. When you are done, click save.
    2. When finished, save and test run the flow.

    User's image

    User's image

    User's image

    1. View the results of the copy.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.