Powershell script to move onedrive folder to Another folder

Tejal Katkar 1 Reputation point

Hello Team,

Require kind assistance, i have onedrive folder "Personal Data" , need to move all the contents of this folder ( like files/folders/subfolders etc) to another folder within same OneDrive called "Documents"

This needs to be performed for more than 100 Users. could you please assist if we have any script for the same.

Checked below script & trying to modify it as per my requirement :


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.
2,702 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,144 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Haoyan Xue_MSFT 20,431 Reputation points Microsoft Vendor

    Hi @Tejal Katkar ,
    When you make any changes to a document (files/folders/subfolders) in sites, OneDrive will automatically update the changes you made in a very short time. So to move OneDrive "Personal Data" folder to "Document" folder, you just need to move site level "Personal Data" folder to "Document" folder using powershell. "OneDrive will be updated automatically.
    Here is my test result, I use PnP PowerShell code to move the "Personal Data" folder in the document library to the "Document" folder, and OneDrive automatically moves the "Personal Data" folder to the " Document" folder.
    PnP PowerShell code:245344-movefolder.txt

    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.