if ($Name=Get-ChildItem $Source -filter $User) {
$new= $Name.FullName -replace "^\\\\"
$NewName="\\?\UNC\" + $new
$NewName
gci -LiteralPath $NewName -Exclude "Application Data" #Не работает | gci -Recurse -File|? { $_.FullName.Length -GT 200}|ft @{'n'='Path length';'e'={$_.FullName.length}}, FullName
}
}
foreach ($User in (Get-Content C:\Scripts\1.txt)) { if ($Name=Get-ChildItem $Source -filter $User) { gci -Path $Name.FullName -Exclude "Application Data","AppData" |foreach { $new= $_.FullName -replace "^\\\\" $NewName="\\?\UNC\" + $new gci -LiteralPath $NewName -Recurse -File|? {($_.FullName -notmatch "FirefoxPortable") -and ($_.FullName.Length -GT 255)}|` select @{n="Length";e={$_.FullName.length}}, @{n="Name"; e={$_.FullName -replace "\\\\\?\\UNC\\srv\\profile\\UserData2\\"}} |Export-Csv C:\Scripts\LongPath.csv -NoTypeInformation -Append } } } Вот так в итоге -Exclude в литпаз сделал, громоздко, но ок
$new= $_.FullName -replace "^\\\\" $NewName="\\?\UNC\" + $new можно упростить до $NewName = $_.FullName -replace "\\\\",'\\?\UNC\'
Обсуждают сегодня