Copy-Item with file exclusions using -Exclude parameter RRS feed

  • السؤال

  • I am writing a PowerShell task using psake to copy over a directory structure and I am having some problems with the copy task:

    $ExclusionFiles = @("packages.config", "connectionStrings.config")
        Copy-Item -Path $SourcePath -Destination $DestinationPath -Exclude $ExclusionFiles -Recurse -Force

    When I run this command, it works properly but does not exclude the files that I specified in the $ExclusionFiles array parameter.

    How can I get the Copy-Item to properly exclude my specified files (they exist at the root of my source path directory)?

    Please advise.


    29/جمادى الثانية/1437 06:27 م


جميع الردود