I need to generate a configuration file for our Pro/Engineer CAD system. I need a recursive list of the folders from a particular drive on our server. However I need to EXCLUDE any folder with 'ARCHIVE' in it including the various different cases.
I've written the following which works except it doesn't exclude the folders !!
$folder = "T:DrawingsDesign*"
$raw_txt = "T:Design ProjectsDesign_AdminPowerShell
aw.txt"
$search_pro = "T:Design ProjectsDesign_AdminPowerShellsearch.pro"
$archive = *archive*,*Archive*,*ARCHIVE*
Get-ChildItem -Path $folder -Exclude $archive -Recurse | where {$_.Attributes -match 'Directory'} | ForEach-Object {$_.FullName} > $search_pro
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…