Hi guys, let’s explore some amazing ways to completely migrate a nested folder structure with lots of different files which is from your local path to a SP online library using PnP PowerShell.

hostforlifebanner

Here is the script to run on Windows ISE Powershell:

Just enter your own respective details which are highlighted in the above script.

When it starts running, enter your Site Admin/Global Admin Tenant details to start the processing.

You can see the Uploading in Progress on your Windows Powershell ISE Interface. Just wait until it gets finished!

This script copies the contents of a folder to the SharePoint Online document library. It overwrites any existing file in the target SharePoint Online library. It creates a folder if it doesn’t exist on the target site already. We can also use this script to migrate files and folders from network file share to SharePoint Online document library!

Creative Idea

You can have the above script triggered through a Flow/Azure Flow[Logic Apps] to have an automated Copying and include Removal in the Source to establish an Automated Archival Process for your Business needs.