如果我想移动以下结构
Parent
ChildParent
ChildOfAChildParent
到以下位置:
NewParent
NewChildParent <-- here
运行以下命令时,我得到以下信息
Copy-Item "\Parent\ChildParent\ChildOfAChildParent" -Destination "NewParent\NewChildParent" -Recurse
NewParent
NewChildParent
ChildOfAChildParent
这不是我想要的行为,我不知道如何实现。我只想将文件和文件夹从 ChildOfAChildParent 转储到 NewChildParent 中,而不创建新的父目录。
最佳答案
我能够通过在我的路径中添加 \*
来解决这个问题(很少),所以它实际上是:
Copy-Item "\Parent\ChildParent\ChildOfAChildParent\*" -Destination "NewParent\NewChildParent" -Recurse
关于powershell - Copy-Item 将项目移动到另一个位置而不创建父目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24805320/