Copy-Item
每次使我绊倒。有人可以告诉我我在这里做错了吗?
我有一组文件夹:
C:\FolderA\Thing\Sub1\1_file.css C:\FolderA\Thing\Sub2\A_file.css C:\FolderA\Thing\page.html
我尝试使用Copy-Item
将它们发送到C:\FolderB\*
并保留结构:
Copy-Item -Path $srcFolder\Thing\* -Destination $destFolder\Thing -Recurse -Force -Verbose
预期结果:
C:\FolderB\Thing\Sub1\1_file.css C:\FolderB\Thing\Sub2\A_file.css C:\FolderB\Thing\page.html
相反,我最终得到:
C:\FolderB\Sub1\1_file.css C:\FolderB\Sub2\A_file.css C:\FolderB\page.html
这里显然有一个\Thing
文件夹,所以如果我告诉它递归进行,为什么它不创建\Thing
?