EMCopy - A Robocopy Replacement
We have a mix of Git, Ant and Robocopy scripts for deployments at work.
I’ve been working on moving everything into Jenkins.
We have a few projects that have a LOT of files. And I quickly ran into an issue using Robocopy to move them to the server took forever.
Doing some research I found a few things…
Newer versions of Robocopy support a ’thread’ option. This can dramatically speed up copying, but… it’s only supported on newer servers (2008+).
Testing copies to my local workstation (Win7) were really quick but when I copied the same files to a Windows 2003 server things were much slower.
The next thing I ran into was Robocopy’s total failure on doing differential copies.
I was expecting rsync and got a slightly beefier Xcopy instead.
Despite trying all sorts of flag options I could never get Robocopy to just copy files that had changed. Robocopy seems stuck to the date last modified of the file and while it appears it also checks for file differences the date always wins.
So I went looking for an alternative.
I stumbled upon a few posts that mentioned Emcopy, a tool created by EMC. The license is a bit vague but a few quick searches and I was able to find a copy.
The syntax is exactly like Robocopy:
:::text emcopy.exe \\source\path \\destination\path
But several of the flags are different.
I ended up using the following flags:
:::text emcopy.exe \\source\path \\destination\path /de /nosec /s /xd images /th 16 /r:3 /w:30
- /de - this compares date AND file differences
- /nosec - emcopy can copy permission but this flag ignores all that
- /s - copies subdirectories/files
- /xd - exclude directories
- /th - threading
- /r:5 - will retry X times if it encounters an error
- /w:30 - how long it waits between retries
Doing some benchmarks I didn’t see a huge increase in speed over Robocopy during the initial copy when the destination directory was empty.
Where Emcopy stood out was in subsequent copies:
:::text [emcopy] File(s) copied : 1 [emcopy] Amount of copied byte(s) : 188 Byte(s) (188 Byte(s)) [emcopy] Estimated copy bitrate : 0.015 KB/s [emcopy] Global copy duration : 11.865 [emcopy] [emcopy] Elapsed time: secs: 12
Where Robocopy would have copied all the files over again, Emcopy simply copied the one file I updated.
Again I’m not sure of the license of Emcopy but if you search you can find several posts on how to get it and it is easily found. The download includes 32 and 64 bit files and a well documented README file and of course there is help available at the command line.
I still want to look at some other options but so far Emcopy seems very promising.