Copy all files and folders from one HDD to another HDD using Robocopy?

riahc3

Senior member
Apr 4, 2014
640
0
0
I want to copy all files/folders (including system/hidden/etc) from one drive to another.

Source drive is S: (mapped network drive)
Destination drive is
Code:
D:

Would this be the command?

Code:
robocopy s: d: /E /MT:20 /V /ETA /LOG:c:robocopy.txt /TEE


Is there a better way to do this?

Thank you
 
Last edited:
Feb 25, 2011
16,800
1,474
126
I have a scheduled task on my computer at home that does this. Can't paste it in now (i'm at work) but you should exclude the recycle bin and system volume information folders.
 

riahc3

Senior member
Apr 4, 2014
640
0
0
I have a scheduled task on my computer at home that does this. Can't paste it in now (i'm at work) but you should exclude the recycle bin and system volume information folders.
Well, then you can, please do it ASAP....thank you
 

Carson Dyle

Diamond Member
Jul 2, 2012
8,174
524
126
This is what I use. It avoids copying (or attempting to copy) the hidden recycle bin and "System Volume Information" folders (using /xd - exclude directories).

You may want to also explore switches for copying file and folder permissions, which I haven't included. At home I use very simple permissions on data partitions, with everything inheriting its permission from the root.

Code:
robocopy S: D: /mir /r:5 /w:10 /xd "$RECYCLE.BIN" "RECYCLER" "System Volume Information" /v /np /tee /log:C:\copydrive.log

I'd test the /MT:n (multi-threaded) switch before using it, especially with 20 threads. I can see how it might be faster across a network, but for local disks, I'm skeptical. I haven't tried it, though.
 
Last edited:

corkyg

Elite Member | Peripherals
Super Moderator
Mar 4, 2000
27,370
238
106
Why not consider just imaging or cloning the drive to create a duplicate drive?
 

seepy83

Platinum Member
Nov 12, 2003
2,132
3
71
Below is an example of the switches that I use fairly regularly. The /COPYALL (or /COPY:DATSOU) is important if you want to preserve file attributes, timestamps, NTFS ACLs, etc.

robocopy d:\ f:\ /copyall /e /zb /r:1 /w:1 /v /tee /np /log:c:\robo.txt


D:\ source
F:\ Destination
/COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU).
/E : Copy Subfolders, including Empty Subfolders.
/ZB : Use restartable mode; if access denied use Backup mode.
/R:n :: number of Retries
/W:n :: Wait time between retries
/TEE : Output to console window, as well as the log file.
/NP : No Progress - don’t display % copied.
/LOG :: Output log file
 
Last edited:

riahc3

Senior member
Apr 4, 2014
640
0
0
Below is an example of the switches that I use fairly regularly. The /COPYALL (or /COPY:DATSOU) is important if you want to preserve file attributes, timestamps, NTFS ACLs, etc.

robocopy d:\ f:\ /copyall /e /zb /r:1 /w:1 /v /tee /np /log:c:\robo.txt


D:\ source
F:\ Destination
/COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU).
/E : Copy Subfolders, including Empty Subfolders.
/ZB : Use restartable mode; if access denied use Backup mode.
/R:n :: number of Retries
/W:n :: Wait time between retries
/TEE : Output to console window, as well as the log file.
/NP : No Progress - don’t display % copied.
/LOG :: Output log file

Could you explain exactly what is "restartable mode?" Besides that, I like this version:

Code:
robocopy s:\ d:\ /copyall /e /r:1 /w:1 /v /tee /log:c:\robo.txt
 

seepy83

Platinum Member
Nov 12, 2003
2,132
3
71
You may want to increase the number of Retries and Wait Time between retries.

Restartable mode means that if the copy fails in the middle of copying a file, the next run of robocopy will pick up where it left off. That's particularly useful if you're copying large files overs a slow, unstable, link.

The "B" (backup mode) part of /ZB tries a different method to read/copy the files from the source in event that access is denied.
 

Carson Dyle

Diamond Member
Jul 2, 2012
8,174
524
126
Using /E instead of /MIR is only really applicable to doing backups, as it will not do a /PURGE. So if a file or folder exists in the target that has been deleted from the source, it will remain in the target. If the target is empty, it makes no difference. But if the target contains files, possibly from a previous run of the same command, then the new folder structure could end up with additional files and folders that aren't in the source. Depends on what the OP is trying to accomplish.

IIRC, the 'System Volume Information' folder copy will fail due to lack of permission. So it doesn't have to be explicitly excluded. However, if you're using multiple retries with a significant wait between them, you'll only slow down the operation as robocopy repeatedly attempts to copy the protected folder.
 

seepy83

Platinum Member
Nov 12, 2003
2,132
3
71
Using /E instead of /MIR is only really applicable to doing backups, as it will not do a /PURGE... *SNIP*

True. It does really depend on what your goals are. Luckily robocopy has a ton of options to make it incredibly useful for various things copy-related.
 
Feb 25, 2011
16,800
1,474
126
Why not consider just imaging or cloning the drive to create a duplicate drive?
Easier individual file restore?

I'm copying a data drive (not my boot drive) so it's not like i need to preserve any hidden data, just the file structure.
 

riahc3

Senior member
Apr 4, 2014
640
0
0
You may want to increase the number of Retries and Wait Time between retries.

Restartable mode means that if the copy fails in the middle of copying a file, the next run of robocopy will pick up where it left off. That's particularly useful if you're copying large files overs a slow, unstable, link.

The "B" (backup mode) part of /ZB tries a different method to read/copy the files from the source in event that access is denied.
OK so based on this information:

Code:
robocopy s:\ d:\ /copyall /e /zb /mt:20 /r:10 /w:10 /v /tee /log:c:\robo.txt
 
Last edited: