我需要为我们的Pro/Engineer CAD系统生成配置文件.我需要一个来自我们服务器上特定驱动器的文件夹的递归列表.但是我需要在其中排除任何带有"ARCHIVE"的文件夹,包括各种不同的情况.
我写了以下哪些有效但除了它不排除文件夹!!
$folder = "T:\Drawings\Design\*"
$raw_txt = "T:\Design Projects\Design_Admin\PowerShell\raw.txt"
$search_pro = "T:\Design Projects\Design_Admin\PowerShell\search.pro"
$archive = *archive*,*Archive*,*ARCHIVE*
Get-ChildItem -Path $folder -Exclude $archive -Recurse | where {$_.Attributes -match 'Directory'} | ForEach-Object {$_.FullName} > $search_pro
Run Code Online (Sandbox Code Playgroud)