[英]search for a folder buried in a folder and move the folder to a new destination
I want to move the Favorites folder from a folder that changes its folder guid daily from Appsense
. 我想将“收藏夹”文件夹从每天更改自
Appsense
文件夹guid的文件夹中Appsense
。
Text between quotes changes. 引号之间的文本更改。
C:\appsensevirtual\S-1-5-21-220523388-2000478354-839522115-60875\'{647CFC75-E4C0-4F13-9888-C37BA083416C}'\_Microsoft Office 2010
I have found this but it never copies to the H: (Homedrive). 我已经找到了,但是它从未复制到H:(Homedrive)。
Get-ChildItem "C:\Appsensevirtual" -Recurse -Filter "Favorites*" -Directory |
Move-Item -Destination "H:\Favorites"
If i run I get this in an Powershell Administrator Window (powershell 2) 如果我运行,我会在Powershell管理员窗口(powershell 2)中找到它
PS C:\temp> .\favorites.ps1
Get-ChildItem : A parameter cannot be found that matches parameter name 'Directory'.
At C:\temp\favorites.ps1:1 char:76
+ Get-ChildItem "C:\Appsensevirtual" -Recurse -Filter "Favorites*" -Directory <<<< | Move-Item -Destination "H:\Favorites"
+ CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
You solution is: 您的解决方案是:
Remove -Directory
from your command, and add -Force
which will parse system & hidden folders. 从命令中删除
-Directory
,然后添加-Force
,它将解析系统和隐藏文件夹。
Get-ChildItem "C:\Appsensevirtual" -Recurse -Filter "Favorites*" -Force |
Move-Item -Destination "H:\Favorites"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.