我想在一個路徑來獲得文件(實際上是大量的文件)的列表,遞歸,不包括某些類型:如何從Get-ChildItem中排除項目列表導致powershell?
Get-ChildItem -Path $path -Recurse | ? { $_.Name -notlike "*.cs" -and $_.Name -notlike "*.tt" }
但我排除的一個長長的清單(僅舉幾例):
Get-ChildItem -Path $path -Recurse | ? { <# what to put here ?#> }
:
@("*.cs", "*.tt", "*.xaml", "*.csproj", "*.sln", "*.xml", "*.cmd", "*.txt")
如何使用這種形式獲得的名單?
它與接受的答案有何不同? – pinepain
@pinepain,我認爲它更簡單,單行,不太冗長,因此與之前接受的答案有所區別。 – Tar