Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a task to download bulk of data(150 GB) from SharePoint document libraries? What will be more efficient and faster,Doing it using a powershell script or using a c# code to download files?

share|improve this question

4 Answers 4

use this powershell script to download Data from SharePoint Document Library.it takes around 2 minutes to download 1Gb data.

if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq $null)
    Add-PSSnapin Microsoft.SharePoint.PowerShell

#Script settings

$webUrl = "http://xyz:1000/"

$docLibraryName = "Documents"
$docLibraryUrlName = "mydocs"

$localFolderPath = "C:\\foldername\\mydocs"

#Open web and library

$web = Get-SPWeb $webUrl

$docLibrary = $web.Lists[$docLibraryName]

$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()

ForEach($file in $files)

    #Open file
    $fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()

    #Add file
    $folder =  $web.getfolder($docLibraryUrlName)

    write-host "Copying file " $file.Name " to " $folder.ServerRelativeUrl "..."
    $spFile = $folder.Files.Add($folder.Url + "/" + $file.Name, [System.IO.Stream]$fileStream, $true)
    write-host "Success"

    #Close file stream

#Dispose web

share|improve this answer

I would certainly use C# for it.

Debugging alone is a major asset for bulk operations and obviously you will have more control over the process.

I prefer using PowerShell for administrative or repetitive tasks only, focusing on simple things.

share|improve this answer

You best bet is to write PowerShell script which iterates through the lists and their items, and eventually download them all. You can use System.IO.FileStream to write the bytes.

share|improve this answer

There will be no difference in speed - I would choose the solution you feel more comfortable with writing.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.