powershell - 使用 Powershell 我想强制复制文件夹/文件而不删除现有目标文件夹中的额外文件 :

标签 powershell

我正在使用 Powershell 并试图强行复制文件夹/文件而不删除现有目标文件夹中的任何额外文件。我被困在试图获得一个工作命令。

以下是我的代码,有关如何解决此问题的任何建议?

Copy-Item -Force -Recurse  –Verbose $releaseDirectory -Destination $sitePath 

最佳答案

你需要确保

$realeseDirectory 

就像
c:\releasedirectory\*
Copy-item永远不要删除目标中的额外文件或文件夹,而是使用 -force如果文件已经存在,它会写

关于powershell - 使用 Powershell 我想强制复制文件夹/文件而不删除现有目标文件夹中的额外文件 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14819205/

相关文章:

regex - 基于字符串中大写/小写和位置的德语元音变音的 Powershell 正则表达式

powershell - 我可以检查我的 PS 脚本需要哪个版本吗?

powershell - 如何在不同的运行空间中运行函数,PowerShell

powershell - PowerShell cmdlet参数列表中的if语句

powershell - 在 Visual Studio Nuget 包管理器控制台中中止 "unclosed"powershell 命令

powershell - 获取最接近给定日期的文件

regex - 如何在Powershell中实现IPv6零压缩?

java - Java 无法读取从 Windows CA 存储导出的证书

powershell - 我可以使参数集依赖于另一个参数的值吗?

powershell - 调用 .NET 方法,方法名称的一部分替换为变量