Download Files in a SharePoint Document Library

Let's say you want to download all the files in a SharePoint document library 2013, do run the following Power Shell commands and it works like a charm.
 
$Site = Get-SPSite “http://mysite/sites”
$files =$Site .RootWeb.GetFolder("My Documents").Files
foreach ($file in $files) {

    $b = $file.OpenBinary()
    $fs = New-Object System.IO.FileStream(("D:\Docs\"+$file.Name), [System.IO.FileMode]::Create)
    $bw = New-Object System.IO.BinaryWriter($fs)
    $bw.Write($b)
    $bw.Close()
}
 
The files are stored in D Drive of your local machine.
Ebook Download
View all
Learn
View all