It seems to me that usage of robocopy in the previous answers do not actually answer the question, that is, to copy the source folder, with its contents, to the destination folder.
The following is what worked for me. It preserves the creation dates and logs activities both to a file and to the screen. It also retries to read a file up to 5 times if inaccessible. Feel free to modify the flags to suit your needs.
robocopy 'G:\Some Directory\A ' 'E:\Some Directory\A ' /e /dcopy:T /mt /tee /log:A.log /r:5
/e copies subdirectories including empty directories
/dcopy:T includes timestamps
/mt multitreaded (8 threads by default)
/tee write status to both console and log
/log:A.log writes status to log file A.log
/r:5 retries 5 times on copy failure
Two observations that seemed non-obvious to me:
- The path strings need to end with a space in order for the source root directory to be created at the destination, and not only its contents without the containing directory.
- The root directory at the destination needs to be in the destination path, even though it doesn't exist before issuing the command.
- The original creation date of the root directory will still be preserved.
I find it surprising that an operation as commonly desired as the one asked about is not better documented.