This one provides a little more info than Mike's (again, replace web URL and list name). I'm outputting to a text file because you said there's 32000 folders, I doubt you want to scroll through 32000 lines of window buffer:
$TestSPSnapin = get-pssnapin | ? { $_.Name -eq "Microsoft.SharePoint.Powershell"}
if($TestSPSnapin -eq $null){
add-pssnapin -Name Microsoft.SharePoint.Powershell #-ErrorAction SilentlyContinue
# SilentlyContinue is only good for interactive console where you're sure of each command you're running. Otherwise, the script should block execution on snapin load failure.
}
function CheckFolderContents ($folder)
{
$folderContent = "Folder at URL " + $folder.Url + " has " + $folder.Files.Count + " files and " + $folder.SubFolders.Count + " subfolders.`n"
Add-Content C:\FolderContents.txt $folderContent
foreach($subfolder in $folder.SubFolders)
{
if ($subfolder.item -ne $null) # the default "Forms" folder has a null Item, and we don't need to include the default "Forms" folder as part of this
{
CheckFolderContents $subfolder
}
}
}
## MAIN
$web = Get-SPWeb http://server/site/web
$list = $web.Lists["Name of List"]
CheckFolderContents $list.RootFolder
$web.Dispose()