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 EXCL
You can exclude like this, the regex 'or' symbol, assuming a file you want doesn't have the same name as a folder you're excluding.
$exclude = 'dir1|dir2|dir3' ls -r | where { $_.fullname -notmatch $exclude } ls -r -dir | where fullname -notmatch 'dir1|dir2|dir3'