- This topic has 3 replies, 2 voices, and was last updated 1 week, 2 days ago by
June 30, 2020 at 9:21 pm #239387ParticipantTopics: 4Replies: 6Points: 79Rank: Member
What is the best solution to deal with Long File Path or File names Errors using Copy-item? I am copying from one UNC directory to another UNC Directory. Currently I am manually mapping the source and destination then manually copying over the long names. I cannot modify any of the file paths or file names. I have had the same issue with Robocopy but might be missing a switch.
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
June 30, 2020 at 9:28 pm #239399ParticipantTopics: 3Replies: 431Points: 1,533Rank: Community Hero
July 4, 2020 at 9:02 pm #240293ParticipantTopics: 4Replies: 6Points: 79Rank: Member
I didn’t get any errors when running the following syntax for the file path. (Ran on Server 2012 R2 with Powershell 5.1)
Copy-Item -path “\\?\UNC\Corp1.com\test1” -Destination “\\?\UNC\Corp2.com\test2” -Recurse
July 6, 2020 at 4:27 pm #240668ParticipantTopics: 3Replies: 431Points: 1,533Rank: Community Hero
You are likely hitting a double hop issue. If you can log into that remote machine and run the script fine, but fails when ran remotely with the same user, then this is likely the issue. Try moving the script local to the target as a test as well.
- You must be logged in to reply to this topic.