Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
不要使用PowerShell的复制项复制文件夹.git及其内容_Powershell - Fatal编程技术网

不要使用PowerShell的复制项复制文件夹.git及其内容

不要使用PowerShell的复制项复制文件夹.git及其内容,powershell,Powershell,我有一个.yaml文件,其中我正在使用powershell复制一个项目,我不想复制.git文件夹。这是我的剧本。它复制.git文件夹 deploy_job: stage: deploy script: - Copy-Item . c:\ColdFusion11\cfusion\wwwroot\website1 -Exclude .git* -recurse 编辑: 我可以用这个来做。如何添加多个文件夹 Get-ChildItem C:\ColdFusion11\cfusion\ww

我有一个.yaml文件,其中我正在使用powershell复制一个项目,我不想复制.git文件夹。这是我的剧本。它复制.git文件夹

deploy_job:
  stage: deploy
  script:
  - Copy-Item . c:\ColdFusion11\cfusion\wwwroot\website1 -Exclude .git* -recurse
编辑: 我可以用这个来做。如何添加多个文件夹

Get-ChildItem C:\ColdFusion11\cfusion\wwwroot\website1 | where { !(($_ -is [System.IO.DirectoryInfo]) -and ($_.Name -eq ".git")) } | Copy-Item -Destination C:\website1 -Recurse

“排除”似乎不适用于复制项。有一种解决方案可以将Get-ChildItem和Copy-Item结合起来以获得所需的结果:Exclude的可能重复项似乎不适用于Copy-Item。有一种解决方案可以将Get-ChildItem和Copy-Item组合起来以获得所需的结果:可能的