How to overcome long file path issues with robocopy?

VJ-8370 446 Reputation points
2020-09-11T12:12:17.993+00:00

Hi,

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?

Regards,
VJ

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

Accepted answer
  1. Xiaowei He 9,876 Reputation points
    2020-09-14T03:07:24.317+00:00

    Hi,

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

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

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

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

    24381-image.png

    https://learn.microsoft.com/en-us/azure/storage/files/storage-files-migration-overview

    Thanks for your time!
    Best Regards,
    Anne

    -----------------------------

    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.

    3 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Leon Laude 85,686 Reputation points
    2020-09-11T12:33:43.52+00:00

    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,
    Leon

    1 person found this answer helpful.

  2. gastone canali 151 Reputation points
    2020-09-12T09:27:25.44+00:00

    As @Leon Laude said robocopy supports long path, but some version (OS dependent), in the past, had problem with permission.
    You can also use https://learn.microsoft.com/en-us/windows-server/storage/storage-migration-service/overview

    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