PowerShell Count Files

This script will count the numbers of files in a folder and output to file.

$dirs = “dir.txt”

foreach ($dir in [System.IO.File]::ReadLines($dirs)) {
“$dir, $((Get-ChildItem $dir -filter “*.msg” -ea 0).Count)”
}

email me