DEV Community

redhcp
redhcp

Posted on

List Numbers Files by Dir in Select Path - Powershell

This script list numbers files by dir in select path

$folders = get-ChildItem -Directory -Path "C:\YOUR_PATH"
$folders |
ForEach-Object { 
        $path = $_.FullName
    [pscustomobject]@{
        Path = $path
        FileCount = (Get-ChildItem -Path $path -Recurse -File).Count 
    }
}
Enter fullscreen mode Exit fullscreen mode

Thanks for read!

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More