1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Robocopy command slower than CopyFile api

Discussion in 'Windows' started by Suvin, Oct 11, 2017.

  1. Suvin

    Suvin New Member

    Joined:
    Jul 6, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Hi, Please help me in understanding the robocopy command. Below is my scenario.

    I wanted to copy 183 GB file from one folder to another.

    Copy command was taking 28 Min to copy the file.

    robocopy command took 22 Min. I used the option /COPYALL /MT /Z

    But CopyFile() api took only 18 Min.

    My question is, (1)is there any api for robocopy that I can used to see performance improvement aginst copyFile api? (2) What could be reason for CopyFile() api being faster than robocopy ?



    This is a blocker for me. My current code is using CopyFile api. I want to replace it with robocopy.

    Thanks in advance for the help.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,312
    Likes Received:
    372
    Trophy Points:
    83
    Why do you want to replace the command that is taking less time with the one that is taking more time?

    And the question is where do you want to be replacing it? Some batch files or some shell script?
     
  3. Suvin

    Suvin New Member

    Joined:
    Jul 6, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Thanks for your response.
    I am an application developer and my requirement is to restore a snapshot. For that I need to copy a file from one location to another.
    My application is developed in VC++ and thus for copying we make use of CopyFile api. As Microsoft claims that robocopy is faster, we had a plan to replace our existing code with robocopy.
    Thus as part of analysis I did the above experiment.
    I would like to know the reason that robocopy command is slower than copyFile api.
    Can i use any other parameters in robocopy to make it faster.
    How can I make the best use of /MT option in robocopy. I tried /MT:8, /MT:16, /MT:32 and /MT:128 but all gave me similar results.
     
    shabbir likes this.
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,312
    Likes Received:
    372
    Trophy Points:
    83
    Yes people do say it is faster and here is one more thread in technet https://social.technet.microsoft.co...5d20b1bf/xcopy-vs-robocopy?forum=winservergen

    But again robocopy has more options as that is what I get from here https://stackoverflow.com/questions/24121046/difference-between-xcopy-and-robocopy and nothing much on the speed front.

    But all those are comparing to xcopy and not filecopy
     

Share This Page