I need to get all the documents name inside the folder from shared document using power shell.



Try this script

Add-PSSnapin Microsoft.SharePoint.PowerShell -ea 0

$web = Get-SPWeb -Identity "weburl"

$rfolder=$web.Lists["Shared Documents"].RootFolder

Function GetFiles($folder)
   Write-Host "+"$folder.Name
   foreach($file in $folder.Files)
       Write-Host "`t" $file.Name

   # Use recursion to loop through all subfolders.
   foreach ($subFolder in $folder.SubFolders)
       Write-Host "`t" -NoNewline

You might also find some more usefull info at https://stackoverflow.com/questions/8024103/how-to-retrieve-a-recursive-directory-and-file-list-from-powershell-excluding-so

$web.Lists["Documents"].RootFolder.SubFolders["Your Folder Name"].Files
  • Thanks for the reply. But actually i want to get the files inside the folder from Shared Documents library in one of the site. I don't want to provide the folder name. It should find folder automatically. – Ishani Feb 27 '15 at 12:33
  • 1
    @Ishani, there can be plenty of folders inside the library. The script needs to know some kinda logic to get files from a particular folder. – Nadeem Yousuf-AIS Feb 27 '15 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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