SHarePoint 2016 OnPrem
2 TopicsSharePoint powershell to retrieve count of files in 2nd level subfolder in all subsites
Hi, How to generate a report in csv to count of all files present in 2nd level subfolder [Change Requests] in all subsites https://www.sharepointdiary.com/2017/03/get-all-list-and-libraries-inventory-of-site-collection-using-powershell.html I have edited source from this https://sharepointrelated.com/2014/11/11/download-all-content-in-a-site-collection/ ... $lists = $web.lists | ?{$_.title -eq "Documents" -and $_.itemcount -ge "1" -And $_.BaseType -eq "DocumentLibrary"} #Change any identifier here foreach($list in $lists) { Write-Host "- $($list.RootFolder.url)" $DirpathList = $Dirpath +"\"+$list.title CreateFolder($DirpathList) #Download files in root folder #$rootfolder = $web.GetFolder($list.RootFolder.Url) #Download-SPContent($rootfolder) #Download files in subfolders foreach($folder in $list.folders) { #$folder = $web.GetFolder($folder.url) if ($folder.name -eq "Change Requests") { $folder = $web.GetFolder($folder.url) Download-SPContent($folder) } } } Thanks956Views0likes0Comments