• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

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

riahc3

Senior member
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:
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.
 
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:
Why not consider just imaging or cloning the drive to create a duplicate drive?
 
Below is an example of the switches that I use fairly regularly. The /COPYALL (or /COPY😀ATSOU) 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😀ATSOU).
/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:
Below is an example of the switches that I use fairly regularly. The /COPYALL (or /COPY😀ATSOU) 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😀ATSOU).
/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
 
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.
 
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.
 
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.
 
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:
Back
Top