【发布时间】:2012-03-15 03:31:10
【问题描述】:
当我从具有子文件夹的文件夹运行递归 Copy-Item 到包含与原始文件夹相同的子文件夹的新文件夹时,当子文件夹已存在时会引发错误。
我该如何抑制这种情况,因为它是一种假阴性并且会使真正的失败更难被发现?
例子:
Copy-Item "C:\realFolder\*" "C:\realFolder_new" -recurse
Copy-Item : Item with specified name C:\realFolder_new\subFolder already exists.
【问题讨论】:
-
添加 -Force 能解决问题吗?
标签: powershell copy-item