Search This Blog

Monday, 24 September 2018

Powershell fast way to count files in a folder

I had a Windows server folder that had crept over 1 million files unnoticed. I ran gci | remove-item, but could not see if it was doing anything, so wanted a fast way to count the files in the folder.

I found this snippet on here : http://powershell-guru.com/fastest-powershell-2-count-all-files-in-large-network-share/

[system.io.directory]::EnumerateFiles("D:\inetpub\Badmail") | measure-object

No comments:

Post a Comment