Microsoft 365 Migration

How to Copy a Large SharePoint Online Library with PowerShell

John WilsonJohn Wilson Nov 13, 2026 868 views

Question details

The user needs a reliable method to copy about 1 TB between SharePoint Online document libraries and replace destination files only when the source version is newer.

How to Copy a Large SharePoint Online Library with PowerShell
Product
SharePoint Online / Microsoft 365
Device & OS
not provided
Scenario
Migrating a large document library between two modern SharePoint Online sites.
Observed behavior
Manual Copy to is not suitable for 1 TB; the migration must enumerate files, compare last-modified dates, and copy only newer source files.
Before you start

Before running a SharePoint migration script, confirm that the PnP.PowerShell module is installed and that the account has at least read access to the source library and contribute access to the destination library.

Solution 1Recommended

Use a PowerShell migration script to copy only newer files

Best for large libraries where you need a repeatable, resumable transfer that compares last-modified dates and skips unchanged or newer destination files.

A PowerShell script can page through large lists, compare the Modified property for each source and destination item, and call a copy command only when the source file is newer. This reduces unnecessary traffic and makes the migration easier to audit.

1
Install and connect PnP PowerShell

Open Windows PowerShell as administrator, run Install-Module PnP.PowerShell -Scope CurrentUser -Force, then run Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/source" -Interactive to authenticate to SharePoint Online.

2
Retrieve source and destination file items

Use Get-PnPListItem -List "SourceLibrary" -PageSize 500 to enumerate source files, including the Modified and FileRef fields, and repeat the same call against the destination library for comparison.

3
Compare last-modified dates and copy newer files

For each source item, find the matching destination item by its relative URL. If the source Modified date is newer than the destination Modified date, run Copy-PnPFile -SourceUrl $source.FileRef -TargetUrl $destUrl -Overwrite; otherwise skip the file.

4
Add error handling and progress logging

Wrap the loop in try/catch, append each result to an array, and use Export-Csv to record copied, skipped, and failed files so the script can be re-run safely.

Use a PowerShell migration script to copy only newer files
Resumable migration: Because unchanged or newer destination files are skipped, re-running the script after a timeout only copies the remaining outdated files.
Free Microsoft Office alternative

Use WPS Office to edit the Office files you migrate to SharePoint Online

WPS Office does not manage SharePoint Online migrations, but it offers a free, lightweight way to open, edit, and save the Word, Excel, and PowerPoint files you move between Microsoft 365 and SharePoint document libraries.

Opens and saves Microsoft Office files with high compatibilityFree, lightweight Office suite with a familiar ribbon interfaceWorks smoothly with files downloaded from or uploaded to SharePoint OnlineSupports Word, Excel, PowerPoint, and PDF workflows without a Microsoft 365 subscription
microsoft office alternative - wps office

Frequently Asked Questions

Can I copy 1 TB between SharePoint Online libraries with the Copy to command?

You can, but it is not recommended for 1 TB. A PowerShell script or migration tool is better because it can enumerate files in batches, compare last-modified dates, skip unchanged files, and produce a log for resuming failed or timed-out transfers.

Which PowerShell module should I use for SharePoint Online library migration?

Use the PnP.PowerShell module. Install it with Install-Module PnP.PowerShell -Scope CurrentUser -Force, then connect with Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/source" -Interactive.

How do I copy only files whose source version is newer?

Retrieve the source and destination list items with Get-PnPListItem, compare their Modified properties by relative URL, and call Copy-PnPFile -Overwrite only when the source Modified date is newer than the destination Modified date.

What permissions are required to migrate a SharePoint Online document library?

The account running the script normally needs at least read access to the source library and contribute or edit access to the destination library. If the script uses application permissions, the app must be granted the equivalent SharePoint Sites permissions.

Will WPS Office move my SharePoint Online document library for me?

No. WPS Office is an Office suite for editing files, not a SharePoint migration service. Use SharePoint Online PowerShell, Microsoft 365 tools, or a dedicated migration tool to move the library, and WPS Office to open and edit the resulting Office files.