How to overcome long file path issues with robocopy?

VJ-8370 446 Reputation points


How to overcome long file path issues with robocopy? Any suggestions?

Also, could you please share any best practices to follow in migrating Windows File systems (preserving all attributes) to NetApp CVO on Azure?


Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
11,095 questions
{count} votes

Accepted answer
  1. Xiaowei He 9,816 Reputation points


    ROBOCOPY will accept UNC pathnames including UNC pathnames over 256 characters long.

    "/256 Turns off support for paths longer than 256 characters."

    Below is an article of the guides to migrate to Azure file shares:


    Thanks for your time!
    Best Regards,


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Leon Laude 85,486 Reputation points

    Hi @VJ-8370 ,

    Robocopy supports paths that are larger than 256 characters by default, Robocopy even provides a flag that lets you turn OFF support for long path names (flag: /256).


    (If the reply was helpful please don't forget to upvote or accept as answer, thank you)

    Best regards,

    1 person found this answer helpful.

  2. gastone canali 76 Reputation points

    As @Leon Laude said robocopy supports long path, but some version (OS dependent), in the past, had problem with permission.
    You can also use

    This are two examples of possible solutions using robocoy and icacls

        ROBOCOPY  \\serversource\folder \\serverTarget\folder /E /w:0 /r:0 /xj /b /log:c:\logcopyfile.log  
        ROBOCOPY  \\serversource\folder \\serverTarget\folder /E /w:0 /r:0 /xj /b /Copy:S /IS /IT  log:c:\logcopysecurity.log  
        :: save and restore permission  
        icacls "\\serverSorgente\folder" /save C:\ACL_serversorgente /T      
        icacls "\\serverTarget\folder" /restore C:\ACL_serversorgente