将不同的文件名从计算机复制到 san map 驱动器

copy different file names from a computer to san map drive

powershell 中的正确语法是什么?我试图将不同的文件名从 pc 驱动器 "D" 文件夹复制到 san 映射驱动器文件夹,但没有成功。下面是 3 个文件的通用示例,其中 ip 地址 = 10.10.0.0,h 是到 san 的映射盘符驱动器。感谢您的帮助。

 copy-item \10.10.0.0\D$\folder1\folder2\ "filename1.20170814", 
 "002file.05172017", "name123.log"  H:\folder_a\folder_b\ -Recurse

如果您不确定,我建议您显式而不是隐式指定参数。

$Params = @{
  Path        = '\10.10.0.0\D$\folder1\folder2'
  Destination = 'H:\folder_a\folder_b'
  Include     = @('filename1.20170814','002file.05172017','name123.log')
  Recurse     = $True
}
Copy-Item @Params

PSv2 编辑:

Copy-Item -Path '\10.10.0.0\D$\folder1\folder2'`
          -Destination 'H:\folder_a\folder_b'`
          -Include 'filename1.20170814','002file.05172017','name123.log'`
          -Recurse