【发布时间】:2013-07-15 11:16:50
【问题描述】:
我不敢相信这会像我发现它一样困难。
我在服务器共享上有一个文件夹。此文件夹有许多子文件夹,其中可能包含或不包含我想用最新版本覆盖的文件。
我做了很多谷歌搜索,发现下面的命令可以得到我想要的:
Get-ChildItem \\server1\websites\website\xml -Name "description-15240.txt" -Recurse | Copy-Item ".\description-15240.txt" -Destination $_.fullname
...但事实并非如此。
因此,我将命令分解为多个部分并发现 Get-ChildItem 仅返回来自 -Name 参数根目录的文件路径,即
1\infinite\description-15240.txt 68\无限\description-15240.txt 79\无限\description-15240.txt 80\无限\description-15240.txt
而不是我所追求的 \server1\websites\website\xml\1\infinite\description-15240.txt。
问题:我无法让 Get-ChildItem 返回完整路径
| { $_.FullName } 不这样做
| { $_.Parent }也没有
有人可以帮助并可能告诉我Copy-Item 是否也可以工作吗?
非常感谢,N
【问题讨论】:
标签: powershell get-childitem copy-item