How to Download All Files from a SharePoint Site?

Requirement: Download All Files from a SharePoint Site.

How to Download All Files in SharePoint Site?

When you have lots of different document libraries with files in them, and it takes quite a bit of time to download all the files from one library. Fortunately, there is an easy way to do this! Let’s explore how to easily download all the documents libraries of a site.

To download all files from a SharePoint document library or folder, Simply use the “Explorer View”.

  • Navigate to your SharePoint On-premises or SharePoint Online library.
  • Click on “View in File Explorer” from Views Drop down in SharePoint Online. For SharePoint On-premises, click on “Open with Explorer” button in “Library” tab.
  • From the Explore view, you can download all documents or all attachments from any list or library to your local machine.
    sharepoint download all documents in a library
  • Now in the Explorer view, navigate one level up, and you can download the complete site or site collection using explorer view by navigating up and down to the site, list or library objects.
    download all files from sharepoint
In modern libraries, You can simply select all files and hit “Download” button to download all files from a document library.

PowerShell to Download All Files from SharePoint site:

We can also use WebDav method to download all files from a SharePoint site or site collection. Just set the parameters in the below script and hit run. This PowerShell script copies all files including files in all libraries, document versions, list item attachments of the given site and its subsites to the local disk path provided. You may have to login to the SharePoint site once to establish a session cookie, BTW!

#Configuration Parameters
$DownloadPath= "c:\Downloads\Online"
#$WebDavUrl = "\\\DavWWWRoot\sites\operations"
$webDavUrl = "\\[email protected]\DavWWWRoot\sites\operations" #SharePoint Online

#Create Local Folder it it doesn't exists
If(!(Test-Path $DownloadPath))
      New-Item -ItemType Directory -Force -Path $DownloadPath | Out-Null

#Get All files from the Site and download to local folder
Get-ChildItem -Path $webDavUrl -Recurse | ForEach-Object {
    #Frame the destination path
    $DestinationPath = Join-Path -Path $DownloadPath -ChildPath (Split-Path $_.FullName -NoQualifier).Replace($webDavUrl,'');

    #Copy File to local path
    Copy-Item $_.FullName -Destination $DestinationPath -Force

    Write-host -f Green File Copied to $DestinationPath

This method works in both SharePoint On-premises and in SharePoint Online. Refer to my another post to download all documents using PowerShell: PowerShell to Download All Files from SharePoint Library

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply