Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 25, 2016, 07:12:23 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Is robocopy faster than Windows GUI to "Move" files between drives  (Read 2304 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 499
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
The problem may even be in the manner in which i coded for it.  I had originally thought it to be a lot faster and for small folders this setup worked pretty well but when i tried it on an entire "Downloads" folder with several thousand files, it seemed to bog down.  It also seemed to ignored Ctrl+C to get it to exit for some reason.  If anyone could suggest modifications to allow it to be exited while running as well as restarted without an error (due to the mkdir command not being needed)

Code: Text [Select]
  1. @echo off
  2. cls
  3. set /P  from="Enter Move from Path:  "
  4. set /P to="Enter Move To path:  "
  5. mkdir %to%
  6. FOR    %%i IN ("%from%"\*) DO           MOVE /Y "%%i" "%to%\%%~nxi"
  7. FOR /D %%i IN ("%from%") DO ROBOCOPY /MOVE /E "%%i" "%to%\%%~nxi"
  8. exit

Or maybe a completely different method.  Windows GUI works fine if it didn't have to do the "calculating" test run before it ever starts at all :(

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,394
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #1 on: July 05, 2015, 09:41:55 PM »
You can set Robocopy to use multiple threads, (Win7+ ; by default it is 8), having said that, most likely the problem will be that all the operations are being performed on the same source and destination concurrently which probably leads to a bit of head thrashing on a HDD.

You could try reducing the number of threads Robocopy uses with the /MT:x parameter, (x is the number of threads required between 1 and 128).

Possibly start at /MT:2 and increase by one until you see performance drop off.

mkdir isn't needed for Robocopy, it'll create folders as it goes and it should skip any files that have already been copied (options permitting) according to the table here.

BTW, if you're going to use Robocopy where there's any chance that the files will already be opened then it will fail on those files, (it won't access open files).  You can get around that by either using:
1) ShadowSpawn (which is a replacement for Hobocopy below) which will create a VSS copy before running Robocopy, or;
2) Hobocopy which was a less featured version of Robocopy that could use the VSS, (written by the author of ShadowSpawn).
« Last Edit: July 05, 2015, 10:02:29 PM by 4wd »

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,078
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #2 on: July 05, 2015, 09:46:40 PM »
I believe you can disable the "Calculating size" bit in Directory Opus.

From your code I understand that you want to move stuff from every subfolder in the %from% folder into one giant pile in the %to% folder.

A word to the wise:
The NT-filesystem doesn't like folders with huge amounts of files in them. If you have such a folder, you will notice that Windows will slow down to a crawl...at least until it is finished processing the folder.  Doesn't matter how much "horse-power" your PC has, opening and/or working with a folder that contains several thousands of files, performance degrades significantly. And yes, I know that in theory the NT-file system supports loads and loads of files in whatever structure you can think of. In practice: better keep an eye on the amount of files you store in a folder.
  
I would try something like this:

@ECHO OFF
CLS

::User settings
SET /P srcfolder="      Enter source path:  "
SET /P dstfolder="Enter destination path:  "
    
::Folder check
IF NOT EXIST "%srcfolder%" GOTO :ENDFAIL
IF NOT EXIST "%dstfolder%" MKDIR "%dstfolder%"

::Logic
PUSHD "%srcfolder%
FOR /r %%a IN (*.*) DO (
  MOVE "%%a" "%dstfolder%\%%~nxa"
  )
POPD
GOTO :ENDOK
    
:ENDFAIL
ECHO Folder error: %srcfolder%
EXIT
:ENDOK
EXIT

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,514
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #3 on: July 05, 2015, 10:08:32 PM »
Maybe there's something I don't understand: why are you using the "move" command then using "robocopy /move"?

Robocopy works on directories by default, so instead of using the batch "for" command I think you can do what you want with a single robocopy command:

    robocopy /move /e "%from%" "%to%"

Also, I have heard good things about tools like teracopy, but I don't use such a program myself (I do use XYplorer, which works well enough for my needs).

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,394
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #4 on: July 05, 2015, 10:17:16 PM »
Also, w.r.t. Robocopy, if you look at the options (robocopy /?) under /MT (if you want to play with multi-threading):

---------------------------------
/MT[:n] :: Do multi-threaded copies with n threads (default 8).
               n must be at least 1 and not greater than 128.
               This option is incompatible with the /IPG and /EFSRAW options.
               Redirect output using /LOG option for better performance.
---------------------------------

ie. Don't have it writing to the console.

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 499
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #5 on: July 05, 2015, 11:34:25 PM »
Odd than you tossed in the MT option  I was just playing with that and actually got WORSE results.  I did not try long enough to track down why but i could run it on the same folder with or without the MT (set to 32) and with it on i slowed to a crawl.  With it off, it runs pretty fast just not as fast as I would have expected.  The other difference i THINK i saw was that with the MT on, it seemed to "choose" to do larger files first.  No sure about that but that was my first thought as to why it seemed slow.
With it OFF it seems to run file to file in a direct file-listed by name order. There are so many options.. I have never used it before having set up all  i ever needed with the right switches in Xcopy until lately.  I am sure it is better i just have to learn the "ropes"

As to your other question about the two move commands:
I was reading a tuitorial and when it got the the part where it showed examples, those two were used together.  I was more interested in  finishing tonight so i stopped at that point as soon as i had a working combination.

It looked a little weird to me too and i had begun to think it was just a way of demonstrating the differences in the same script using MOVE or robocopy /move)
That wasn't how it was explained but some of these "tutorials" seem to get started and stopped and forget where they left off :(

You think i should just remove the first line as UnNeeded?  maybe that is why it is slow slowand could even be the bug in the rug with the MT switch

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 499
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #6 on: July 05, 2015, 11:44:25 PM »
Just read yours Mr. Shades.
No i do not want to make a big pile and maybe that is the reason it has that extra line.

When i run this using a source such as c:\users\mike\downloads
and a destination like M:\mikedownloads

the full directory structure of files with folders as they exist end up on the m drive in the folder stated.
This being the Case, my next test was going to look at the Mir commend if it mirrors the file/folder layout of the source and moves it to the destination but i think mir is more for making backups and after done, i wold still have to delete the originals.

I an trying to get the rest of the junk off these old drive so i can reformat them.  What i am dealing with now are personal user files.  Once they are gone, i can disk-part/clean the drives and reformat on Slow to catch all the bad spots (if any) .
these are all 2 TB drives which probably still have a lot of use left in them if i can get them cleaned and reorganized.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,394
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #7 on: July 05, 2015, 11:49:46 PM »
Odd than you tossed in the MT option  I was just playing with that and actually got WORSE results.  I did not try long enough to track down why but i could run it on the same folder with or without the MT (set to 32) and with it on i slowed to a crawl.  With it off, it runs pretty fast just not as fast as I would have expected.  The other difference i THINK i saw was that with the MT on, it seemed to "choose" to do larger files first.  No sure about that but that was my first thought as to why it seemed slow.
With it OFF it seems to run file to file in a direct file-listed by name order. There are so many options.. I have never used it before having set up all  i ever needed with the right switches in Xcopy until lately.  I am sure it is better i just have to learn the "ropes"

It's never "OFF" - you have the choice to run 1 or more threads, by default it is 8.

And, like it says, you should use the /LOG option to redirect output.

It might pay to play with Richcopy first, (Robocopy's GUI counterpart), so that you can try the various options without continuously editing a command file.

Also, the MOVE command won't move folders, so you'd have to recurse the folder structure, recreating it in the destination as you go if needed, (another reason why Robocopy is better).

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 499
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #8 on: July 06, 2015, 12:03:23 AM »
As a final note:  If there was a way to disable;e the "windows file testing" feature i was perfectly happy drag and droppin things like this. But on HUGE folder copies i had to do no mare than 10 sub-folders at a time or the annoying "Calculating" message was more than i could bear.
Hence, the resort to X-copy and from there to see if Robocopy was  a better tool.

Ye gads 4wd what do you do for a living.  You must spend 24/7/365 reading all this stuff!
Yeas thanks much I will opt for rich copy until i can find the best setup to use.
I am almost dine anyway and the little that is left is just an annoyance but i figured i might learn a new tweak or two in the process.

After watching the Pre-mo's (preview-Promo's" for the MS Hololens,... well, i guess that will be then end for computing as we know it. I am sure you have already seen them on YouTube

If MS really honest to God managed to get an entire COMPUTER plus the the batteries and everything else into that small headband ...AND  even if it can do only a fraction of what they showed it doing,
I would have to say somebody must have shot down the Starship enterprise and offloaded their stockrooms at MS headquarters.

I did not get to buy my own GoogleGlasses but for this one I would stand in line.

georgemacin

  • Participant
  • Joined in 2016
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Is robocopy faster than Windows GUI to "Move" files between drives
« Reply #9 on: February 14, 2016, 12:52:45 AM »
Check this, more about....Robocopy

Macin