Copy files from source directory to target directory and exclude specific file types from specified directories
问题 I have created a simple Powershell script to copy files during a deployment from a target directory to a source directory and I would like to exclude a list of files. The caveat however is that I would like the ability to exclude files only from a sub directory if specified. This is the snippet I'm using to perform the copy and exclude a list of files: $SourceDirectory = "C:\Source" $DestinationDirectory = "C:\Destination" $Exclude = @("*.txt*", "*.xml*") Get-ChildItem $SourceDirectory