Forum Discussion

Margie Kidd's avatar
Margie Kidd
Copper Contributor
Aug 15, 2018
Solved

Empty folders in SharePoint

Can anyone tell me how to identify SharePoint folders that have 0 files?

  • Hi Margie -

     

    There is a column in every library called Folder Child Count and Item Child Count.  If you add these columns to a view, you can see which folders contain sub-folders or documents.  (Item Child Count is for documents).

     

    Would this help?

     

    Regards,

    Tom Castiglia

2 Replies

  • Margie...here is a PowerShell script that should help.

     

    Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue    
    $web = Get-SPWeb http://sharepoint/sitecoll/web
    $list = $web.Lists["List Name"]
    
        foreach($folder in $list.Folders)
        {        
          if($folder.Folder.SubFolders -eq $null)
          {
           Write-Host Empty folder at $folder.Url
          }        
        }
  • Hi Margie -

     

    There is a column in every library called Folder Child Count and Item Child Count.  If you add these columns to a view, you can see which folders contain sub-folders or documents.  (Item Child Count is for documents).

     

    Would this help?

     

    Regards,

    Tom Castiglia

Resources