Powershell command doesnt find files/folder

Viewed 45

Hello I am facing an issue with a script given here by @zett42

PowerShell search recursively for files and folder which the name contains "..."

$DesktopPath = [Environment]::GetFolderPath("Desktop")
$searchPath = '\\?\E:\Network Shares\Commun'
Get-ChildItem -LiteralPath $searchPath -Recurse -File |
Where-Object Fullname -like '*(case*' |
New-DestinationPath -CommonPath $searchPath -Destination "$home\desktop\conflits" -WhatIf | Move-Item -LiteralPath { $_.Path } -Destination { $_.Destination } -WhatIf

For example there is a complete path ;

E:\Network Shares\Commun\DOSSIER COMMUN\OFFRES EN COMMUN\ENGRAM 5000\5520 - Ecole Communale drièle**(case conflict)** - 2022-09-03T011223.317039Z\(subfolders ...)

But the command doesn't find files / folders, my network share contains a lot of long paths. And it contains also some special characters like éèà etc. Can you help me to adapt the command to find the unfound files/folders please ? Thanks by advance :)

0 Answers
Related