Hello @Shahin Mortazave
Thank you for posting here.
We can find the long folder or extention names with the following command:
cmd /c "dir /b /s /a C:\Users\administrator\Documents" | ForEach-Object { if ($.length -gt 250) {$ | Out-File -append C:\longfilepath.txt}}
For example:
Or
Get-ChildItem -Path C:\Users\administrator\Documents -Recurse | Where-Object {$_.FullName.Length -gt 250 }| Select-Object -ExpandProperty FullName | Out-File C:\longfilepath.txt
For example:
From the article below, we can define the length of characters as 260 or shorter if needed.
MAX_PATH: This is the maximum length of a path according to the Windows API, defined as 260 characters.
Long Paths in .NET, Part 1 of 3 [Kim Hamilton]
https://learn.microsoft.com/zh-cn/archive/blogs/bclteam/long-paths-in-net-part-1-of-3-kim-hamilton
Here is a similar case, we can refer to it.
Redirect folder redirection: "Failed to apply ... The filename or extension is too long."
https://social.technet.microsoft.com/Forums/en-US/9a63ec84-90b0-4d7c-8219-e59d736b917c/redirect-folder-redirection-quotfailed-to-apply-the-filename-or-extension-is-too-longquot?forum=winserverfiles
Hope the information is helpful.
Best Regards,
Daisy Zhou