[英]How to Copy column data from one table to another by matching Column names? in SQL or Power Query
[英]Powershell - Copy folders with names matching array
这就是我想要完成的事情
我遇到的问题是根据数组的值过滤目录中的项目
gci $sourcepath -recurse | where {$_.name -like $idlist} | Copy-Item -Destination $DestinationHistoryPath
我假设您已经正确加载了数组。 对于这种特定情况,您不需要-like
运算符。 最好使用-in
或-Contains
。 像下面这样的东西可能会起作用:
Get-ChildItem $sourcepath -Recurse |
Where-Object {$_.Name -in $idlist} |
Copy-Item -Destination $DestinationHistoryPath
如果您使用包含,则需要切换操作数,例如:
Get-ChildItem $sourcepath -recurse |
Where-Object { $idlist -contains $_.Name } |
Copy-Item -Destination $DestinationHistoryPath
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.