Copy-Item – Long File path or File Name Error

Welcome Forums General PowerShell Q&A Copy-Item – Long File path or File Name Error

Viewing 3 reply threads
  • Author
    Posts
    • #239387
      Participant
      Topics: 4
      Replies: 7
      Points: 84
      Rank: 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.

      Error

      Thanks

      Bill

       

      • This topic was modified 2 months, 2 weeks ago by wbfick83.
      • This topic was modified 2 months, 2 weeks ago by wbfick83.
      • This topic was modified 2 months, 2 weeks ago by wbfick83.
    • #239399
      Participant
      Topics: 7
      Replies: 557
      Points: 2,121
      Helping Hand
      Rank: Community Hero
    • #240293
      Participant
      Topics: 4
      Replies: 7
      Points: 84
      Rank: 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)

      Source
      \\Corp1.com\test1

      Destination
      \\Corp2.com\test2

      • This reply was modified 2 months, 2 weeks ago by wbfick83.
      • This reply was modified 2 months, 2 weeks ago by wbfick83.
    • #240668
      Participant
      Topics: 7
      Replies: 557
      Points: 2,121
      Helping Hand
      Rank: 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.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.