2010-06-09 17:13:59 +0000 2010-06-09 17:13:59 +0000

Odpowiedzi (4)

Punkty 109
2013-01-24 21:16:24 +0000

W Powershell 3.0 jest to prostsze,

gci -Directory #List only directories
gci -File #List only files

Jest to jeszcze krótsze,

gci -ad # alias for -Directory
gci -af # alias for -File
Advertisement

Znaleziono rozwiązanie!

Punkty 78
2010-06-09 18:06:03 +0000

Spróbuj tego:

gci . *.* -rec | where { ! $_.PSIsContainer }
Advertisement
Punkty 3
2014-05-19 17:52:55 +0000
Advertisement

W PowerShell 3.0 można również użyć nowo dodanego parametru -Attributes (wraz z operatorami logicznymi)

Get-ChildItem -Recurse -Attributes !Directory+!System

Golfed

dir -r -Attributes !D
Punkty -5
2015-05-07 11:27:01 +0000

W powershell 2.0 najlepszym i najprostszym rozwiązaniem jakie wymyśliłem jest dołączenie wszystkich plików z rozszerzeniem:

get-childitem -Recurse -include *.*

foldery nie mają rozszerzenia więc są wykluczane, uważaj na pliki bez rozszerzenia.