I have a Large SharePoint 2013 farm and i need to know if there is any way i can see how many files of each type there is in the farm.

1 Answer 1


For example, you could use below PowerShell get all files of document content type.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null

function global:Get-SPSite($url){
    return new-Object Microsoft.SharePoint.SPSite($url)
Function GetFiles($Folder)
    foreach ($File in $Folder.Files | Where-Object {$_.Name -match ".doc"} )
     #Write data to CSV File
     "$($Folder.ParentWeb.Site.RootWeb.Title)" +"`t"+ "$($Folder.ParentWeb.Title)" +"`t" + "$($Folder.ParentWeb.URL+"/")$($File.URL)" +"`t" + "$($File.TimeLastModified)" >> C:\Templates.csv
    foreach ($SubFolder in $Folder.SubFolders)
        #Call the function recursively
        GetFiles $SubFolder
"Site Collection `t Site `t Form Template `t Last Modified" > C:\Templates.csv
$WebAppURL= "web application URL"
$SiteColletion = Get-SPSite($WebAppURL)
$WebApp = $SiteColletion.WebApplication
    foreach ($site in $WebApp.Sites)
       foreach($web in $site.AllWebs)
              write-host "scanning site" $web.title "@" $web.URL
Write-host  "Report Generated: C:\Templates.csv" -foregroundcolor green

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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