Exclude list in PowerShell Copy-Item does not appear to be working

前端 未结 10 892
旧时难觅i
旧时难觅i 2020-12-02 11:40

I have the following snippet of PowerShell script:

$source = \'d:\\t1\\*\'
$dest = \'d:\\t2\'
$exclude = @(\'*.pdb\',\'*.config\')
Copy-Item $source $dest -R         


        
10条回答
  •  自闭症患者
    2020-12-02 12:37

    The below snippet will copy all files and folders from $source to $dest, excluding .pdb and .config files from the root folder and sub-folders:

    Get-ChildItem -Path $source | Copy-Item -Destination $dest -Recurse -Container -Exclude @('*.pdb','*.config')
    

提交回复
热议问题