Download complete folders and subfolders in SharePoint on-premise

passuff 6 Reputation points
2021-03-09T16:11:38.713+00:00

I searched the board but couldn't find my case. We are using SharePoint on-premise and are not able to download complete folders but just files. If you select a folder , the download button is grayed and you receive a message that either I do not have the permission to use this feature or the feature is not supported at all. After speaking to our Sharepoint admin I was told that Microsoft has skipped the folder download feature for SharePoint on-premise. I honestly can't believe that as it is a very basic feature to download folders and not just files. Could someone please clarify this point?

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,565 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,784 questions
{count} vote

4 answers

Sort by: Most helpful
  1. Echo Du_MSFT 17,101 Reputation points
    2021-03-10T02:53:05.703+00:00

    Hello @passuff-4972 ,

    By design, Folders and Sub-folders can not support "Download a Copy" feature.

    75960-3.png

    However, you can download folders in the following two ways:

    1) Use the "Open with Explorer" option available at the ribbon row. With the Explorer view open, you can copy+paste the folder in total to your local files, which does the same functionality as downloading would.

    76082-1.png

    2) Use SharePoint Designer to access the folder's path, where you can also download the folder with all of its contents.

    76063-2.png

    Thanks,
    Echo Du

    ====================
    Updated Answer =================

    Hi @passuff-4972 ,

    You cannot see the “All Files” in the SharePoint designer, because the “Enable Managing of the Web Site URL Structure" is disabled by your server administrator in the SharePoint Designer settings.

    Please following steps:

    1) Sign in SharePoint Central Administration as an admin
    2) Go to General Application Settings tab, and click "Configure SharePoint Designer settings"

    76698-settings1.png

    3) Please enable "Enable Managing of the Web Site URL Structure" option under the corresponding web application.

    76771-settings2.png

    4) After enabling, you will see the “All Files” in the SharePoint designer.

    Thanks,
    Echo Du


    Updated Answer --------------------------------

    Hi @passuff-4972 ,

    Please run the below PowerShell script as an admin to download all files(folders) in a Library:

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue  
    #Runtime-Variables  
    $SiteURL = "siteurl"  
    $LibraryName ="libraryname"  
    $DownloadPath ="C:\temp"  
    
    #Function to Download All Files from a SharePoint Folder  
    Function Download-SPFolder($SPFolderURL, $DownloadPath)  
    {  
        Try {  
            #Get the Source SharePoint Folder  
            $SPFolder = $web.GetFolder($SPFolderURL)  
            Write-host $SPFolder  
            $DownloadPath = Join-Path $DownloadPath $SPFolder.Name  
    
            #Ensure the destination local folder exists!  
            If (!(Test-Path -path $DownloadPath))  
            {     
                #If it doesn't exists, Create  
                $LocalFolder = New-Item $DownloadPath -type directory  
            }  
    
            #Loop through each file in the folder and download it to Destination  
            ForEach ($File in $SPFolder.Files)  
            {  
                #Download the file  
                $Data = $File.OpenBinary()  
                $FilePath= Join-Path $DownloadPath $File.Name  
                [System.IO.File]::WriteAllBytes($FilePath, $data)  
                Write-host -f Green "`tDownloaded the File:"$File.ServerRelativeURL          
            }  
    
            #Process the Sub Folders & Recursively call the function  
            ForEach ($SubFolder in $SPFolder.SubFolders)  
            {  
                If($SubFolder.Name -ne "Forms") #Leave "Forms" Folder  
                {  
                    #Call the function Recursively  
                    Download-SPFolder $SubFolder $DownloadPath  
                }  
            }  
        }  
        Catch {  
            Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message  
        }   
    }  
    
    #Main Function  
    Function Download-SPDocumentLibrary($SiteURL, $LibraryName, $DownloadPath)  
    {  
        Try {  
            #Get the  Web  
            $Web = Get-SPWeb $SiteURL  
    
            #Delete any existing files and folders in the download location  
            If (Test-Path $DownloadPath) {Get-ChildItem -Path $DownloadPath -Recurse| ForEach-object {Remove-item -Recurse -path $_.FullName }}  
    
            #Get the document Library to Download  
            $Library = $Web.Lists[$LibraryName]  
            Write-host -f magenta "Downloading Document Library:" $Library.Title  
    
            #Call the function to download the document library  
            Download-SPFolder -SPFolderURL $Library.RootFolder.Url -DownloadPath $DownloadPath  
            Write-host -f Green "*** Download Completed  ***"  
        }  
        Catch {  
            Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message  
        }   
    }  
    
    #Call the Function to export all document libraries from a site  
    Download-SPDocumentLibrary $SiteURL $LibraryName $DownloadPath  
    

    77671-powershell.png

    Thanks,
    Echo Du

    +++++++++++++++++ Updated Answer +++++++++++++++

    Hi @passuff-4972 ,

    I have changed my powershell script.

    Add-PSSnapin Microsoft.Sharepoint.Powershell  
    $SiteURL = "http://sp/sites/echo"  
    $LibraryName ="Documents"  
    $DownloadPath ="C:\temp"  
    Function Download-SPFolder($SPFolderURL, $DownloadPath)  
    {  
         Try {  
             $SPFolder = $web.GetFolder($SPFolderURL)  
             Write-host $SPFolder  
             $DownloadPath = Join-Path $DownloadPath $SPFolder.Name   
             If (!(Test-Path -path $DownloadPath))  
             {     
                 $LocalFolder = New-Item $DownloadPath -type directory  
             }  
             #Loop through each file in the folder and download it to Destination  
             ForEach ($File in $SPFolder.Files)  
             {  
                 #Download the file  
                 $Data = $File.OpenBinary()  
                 $FilePath= Join-Path $DownloadPath $File.Name  
                 [System.IO.File]::WriteAllBytes($FilePath, $data)  
                 Write-host -f Green "`tDownloaded the File:"$File.ServerRelativeURL          
             }  
             #Process the Sub Folders & Recursively call the function  
             ForEach ($SubFolder in $SPFolder.SubFolders)  
             {  
                 If($SubFolder.Name -ne "Forms")  
                 {  
                     #Call the function Recursively  
                     Download-SPFolder $SubFolder $DownloadPath  
                 }  
             }  
         }  
         Catch {  
             Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message  
         }   
    }  
    #Main Function  
    Function Download-SPDocumentLibrary($SiteURL, $LibraryName, $DownloadPath)  
    {  
         Try {  
             #Get the  Web  
             $Web = Get-SPWeb $SiteURL  
             #Delete any existing files and folders in the download location  
             If (Test-Path $DownloadPath) {Get-ChildItem -Path $DownloadPath -Recurse| ForEach-object {Remove-item -Recurse -path $_.FullName }}  
             #Get the document Library to Download  
             $Library = $Web.Lists[$LibraryName]  
             Write-host -f magenta "Downloading Document Library:" $Library.Title  
             #Call the function to download the document library  
             Download-SPFolder -SPFolderURL $Library.RootFolder.Url -DownloadPath $DownloadPath  
             Write-host -f Green "*** Download Completed  ***"  
         }  
         Catch {  
             Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message  
         }   
    }  
    Download-SPDocumentLibrary $SiteURL $LibraryName $DownloadPath  
    

    Thanks,
    Echo Du

    ======================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. passuff 6 Reputation points
    2021-03-10T12:37:02.777+00:00

    We already tried to integrate the Sharepoint content in to the Windows Explorer directly and also by OneDrive. Unfortunately the folder structure is huge and exceeds 400 signs. That's not an issue within Sharepoint but the content in those folders exceeding the limit is not visible in the Win Explorer.

    I'm not able to find the "All Files" item on my Sharepoint:

    sharepoint.png

    We are also using Sharepoint online for different use cases but there we are able to download complete folders and sub folders out of the box. Why there is a difference is such a basic functionality between on premise and online Sharepoint?

    Actually I don't need the functionality (download folders) itself but something letting me download/backup the whole Sharepoint data.


  3. passuff 6 Reputation points
    2021-03-12T05:57:07.017+00:00

    There is no error message. If I choose a folder there is no way to to download it to the explorer. Zhere is just the copy option but this just works inside sharepoint designer so I'm not able to paste it in Windows Explorer.


  4. sadomovalex 3,626 Reputation points
    2021-03-15T14:25:55.533+00:00

    you need to run mentioned Powershell script in Sharepoint Management Shell (not in regular Windows Powershell. And run it as administrator) from the Sharepoint server itself (i.e. not from another server remotely even if it is located in the same domain).