Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
During a short discussion about files system in PowerShell, I got a question.
Can we list only files using PowerShell?
Quick Way
[System.IO.Directory]::GetFiles('C:\') |
Alternate Methods
PowerShell 3.0 and Above
Before we do something in PowerShell - It's better to check the version and explore :) . My way of PowerShell scripting
Get-ChildItem C:\ -File #Returns Only Files Get-ChildItem C:\ -Directory #Returns Only Directories |
Enjoy PowerShell :)