UPDATE: This script has moved to the PowerShell Gallery.  Any new updates will be posted here: https://www.powershellgallery.com/packages/Download-AllSPOFiles/


You can use this script to download all files in a SharePoint site or even a tenant.  This will get everything, including the layout files and such if you desire.  It relies on the Get-PnpFile cmdlet, so if you don't have the SharePointPnPOnline cmdlets, it will download and install them for you.

The script passes through the Get-PnpFile parameters, so you can use -Folder, -Match, and -List as you like.  Default parameter is -Match *, and default OutputPath is the current directory.

I've also posted a new blog that discusses this: https://www.undocumented-features.com/2019/07/12/download-all-files-from-sharepoint-online/