I am trying to sanitize my source code into another folder using Powershell:
dir $sourceDir\* -Recurse -Exclude */bin/*,*/obj/* -Include *.sln, *.myapp, *.vb, *.resx, *.settings, *.vbproj, *.ico, *.xml
And it seems like everything is working fine, however, -Include
directive sort of whitelists the file before -Exclude
, so .XML
files under /bin/
, for example, are included. I would like -Exclude
to take precedence over -Include
, so always exclude /bin/
and /obj/
folders in the above script.
It is possible in Powershell, without writing too much code?