Wednesday, August 12, 2015

Get a directory child count PowerShell

 

Get a count of objects in a directory

This gets you all items in the directory

 

 

(Get-ChildItem -path "c:\source\" -Recurse).count

 

Adding the –include gives you the ability to filter the directory. For example I used –include *.*xl* to get a count of excel files.

 

 

(Get-ChildItem -path "c:\source\" -Recurse -include *.*xl*).count

 

No comments:

Post a Comment