[英]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.