17 July 2022

Compare list of SharePoint files with on-prem file share

If you're migrating files from an on-prem file share to SharePoint, you may need to export a list of files on both sides for comparison:

  1. Install PnP PowerShell:

    Install-Module -Name "PnP.PowerShell"

  2. Connect to the SharePoint site URL:

    Connect-PnPOnline -Url https://company-my.sharepoint.com/sites/SharedFiles -Interactive

  3. Export the SharePoint files/folders in specific directory:

    Get-PnPFolderItem -FolderSiteRelativeUrl "Shared Documents/Folder1" -Recursive | Export-Csv -Path C:\temp\Folder1-SharePoint.csv

  4. Export the corresponding on-prem files/folders: In PowerShell on-prem, CD into the directory then:

    dir -Recurse | Export-Csv -Path C:\temp\Folder1-OnPrem.csv

No comments:

Post a Comment