Here is an example of using PowerShell to look through folders in a SharePoint Document Library.
if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"})) { Add-PSSnapin Microsoft.SharePoint.PowerShell; } $site = Get-SPweb "http://sharepointed.com/site/taco/" $mList=$site.Lists["Shared Tacos"] foreach($f in $mlist.Folders) { Write-Host $f.Name } $site.dispose()
Now, how do you loop through SUBfolders within a folder and display THEIR names?
I won’t be able to test this for a couple days, but the basic idea would be to do another loop inside the loop.
foreach(folder in folders)
{
#then something like
write-host folder.title
if(folder.children.count > 0)
{
loop again…
}
}
You can also look into recursion.