Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Sharepoint Powershell Get items by file extension

$
0
0

Hi,

I'm trying to write a Sharepoint Powershell script in order to count all the items in a site collection by file type. I have found a similar script but in this case it is necessary to specify the file extension and also it doesn't count it.

I have seen that are a similar property for Powershell Get-childItems but it didn't work for Sharepoint.

The code that I have used for filter by file extension is the following:

   Get-SPSite -Limit All |
    Get-SPWeb -Limit All |
   Select -ExpandProperty Lists |
    Where { $_.GetType().Name -eq "SPDocumentLibrary" -and
            -not $_.Hidden } |
    Select -ExpandProperty Items |
    Where { $_.Name -Like "*.docx" } |
    Select Name,
          @{Name="URL";
           Expression={$_.ParentList.ParentWeb.Url + "/" + $_.Url}}

Can anyone help me?

Thanks in advance


Viewing all articles
Browse latest Browse all 11571

Trending Articles