Currently, we have Document Libraries created in SharePoint Online and would like to move them using Powershell to its own Subsite. The reason we would like to move them is that we would like to keep the version history. Since we are dealing with 1000s of files, I would like to use Powershell to complete this task.

I am currently connecting to my SharePoint site using:

Connect-PnPOnline -Url "Sitename" -UseWebLogin

Here is where I need assistance. I am trying to use Move-PnPFolder but I am not sure how to write a command that would define the source, destination, and move of all files in the document library to a subsite that I have manually created.

Help please?

1 Answer 1


The command “Move-PnPFolder” only can move folder between libraries in the current web. It cannot move folders from parent site to subsite.


You could use the PowerShell script to move folder in SharePoint online. For more detailed information, refer to the article below.

SharePoint Online: How to Move a Folder using PowerShell?

  • Getting an error when running the command listed on that site: Error Moving the Folder! Exception calling "ExecuteQuery" with "0" argument(s): "The destination file already exists." Oct 30, 2019 at 13:10
  • I suggest you could rename the file which you want to move.
    – Amy_MSFT
    Oct 31, 2019 at 8:38
  • I am not sure what that means. My Source Library Document is Test and my Destination Subsite is TestS and they both reside in IT Subsite. How can I move files from Test to TestS? Nov 4, 2019 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.