copy files using robocopy

Roger Roger 7,181 Reputation points
2024-09-02T20:12:05.71+00:00

Hi All

My VM is hosted in Azure. I want to copy a folder (which contains subfolders and files, and some of the subfolder and file names exceed the 255-character limit) from one local drive to another. My local drive is the E drive, and the destination drive is the F drive, which is also a local drive. The purpose of copying the folder to the F drive is to detach this drive and attach it to another VM. I want to use Robocopy because some of the file and folder names exceed 255 characters, even if one file is missed then the application may not work. However, when I execute the command below in PowerShell, I receive an error:

PS C:\windows\system32> ROBOCOPY E:\myfolder F:\myfolder /copy /e

Windows for business Windows Server Devices and deployment Set up, install, or upgrade
Windows for business Windows Server User experience PowerShell
Windows for business Windows Server User experience Other
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2024-09-03T05:04:51.9966667+00:00

    Hi @Roger Roger ,

    did you try this already?

    
    robocopy E:\myfolder F:\myfolder /mir /e
    
    

    The reason why your command fails might be because the parameter /copy expects another value: Copy options


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

    Regards

    Andreas Baumgarten

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-09-04T14:53:35+00:00

    Hello,

    Thank you for posting in Q&A forum.

    This problem is caused by the wrong parameter options of the robocopy command. I suggest you run the following command:

    robocopy E:\myfolder F:\myfolder /copyall

    User's image

    I recommend you to refer to the following links:

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

    I hope the information above is helpful.

    Best regards

    Zunhui

    ============================================

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

    1 person found this answer helpful.
    0 comments No comments

  2. Roger Roger 7,181 Reputation points
    2024-09-03T04:04:01.9233333+00:00

    robocopy

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.