2023-04-05

Count files in a folder from Command Prompt / PowerShell

  • Command prompt 
    • dir *.* /a-d | find "File(s)"
    • dir *.* /b /a-d | find /c /v ""
  • PowerShell
    • (Get-ChildItem C:\csv -filter "*.*").Count
    • (Get-ChildItem C:\csv -recurse -filter "*.*").Count recursive search
    • (Get-ChildItem C:\csv -filter "*.*").Count
    • [System.IO.Directory]::GetFiles("c:\Path").Count