I am using powershell to copy folder and files inside. Below is the command im using
Copy-Item "C:\source" "C:\destination" -recurse
i get error
Copy-Item : The specified path, file name, or both are too long. The fully qualified file name must be le characters, and the directory name must be less than 248 characters. At line:1 char:1 + Copy-Item "C:\source" "C:\destination" -recurse + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (component.json:FileInfo) [Copy-Item], PathTooLongException + FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand
i understood the error, but i wanted to know which file is having issue so i can fix it. The Error doesnt show the actual file
I tried using
$error[0]|format-list -force
it shows detail stack trace but it doesn't show the file path
-Verbose
to yourCopy-Item
command, although it might be a lot of console noise I expect you would see the offending file just before the exception. – ATek