【问题标题】:Copy-Item problem with destination目的地的复制项目问题
【发布时间】:2011-04-27 11:06:46
【问题描述】:

我有两个复制项命令

  1. Copy-Item "C:\Test\folder1" "\\remote_machine\destination" -Recurse

  2. Copy-Item "C:\Test\folder2" "\\remote_machine\destination" -Recurse

folder1 和 folder2 包含文件夹和文件

两个命令相似,但我得到不同的结果

  1. 将文件夹 1 的内容复制到目标 - 确定
  2. 将包含所有内容的文件夹 2 复制到目标 - \remote_machine\destination\folder2 - 失败

更新:我没有收到任何错误。问题是关于第二个文件夹的路径。我想要一个目标文件夹中的两个文件夹的内容。

【问题讨论】:

  • 可能是 folder2 的内容导致了错误。你得到什么错误?

标签: powershell command


【解决方案1】:

这是 PowerShell 的问题 - http://groups.google.com/group/microsoft.public.windows.powershell/browse_frm/thread/ae9b8b4424c2af22

我的例子的解决方案是

  1. Copy-Item "C:\Test\folder1" "\\remote_machine\destination" -Recurse
  2. Copy-Item "C:\Test\folder2\*" "\\remote_machine\destination" -Recurse

【讨论】:

    猜你喜欢
    • 2021-03-29
    • 1970-01-01
    • 2021-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-13
    • 1970-01-01
    相关资源
    最近更新 更多