Copy files and preserve folder structure

I have to copy a bunch of files from one drive to another. Simple Strg+C is to unreliable and has to start from the beginning, if the copy process gets interrupted. xcopy %source% %destination% has no sufficient logging options. The solution should be a command line script, to simply rerun the task.
2 answers

Use rsync to copy files

There is a tremedous tool out there: rsync.
Though mostly Linux based, there is a Windows version available (using cygwin):

Rsync can transfer files from everywhere to everywhere, so to speak. It provides network and encrypting capabilities as state of the art.

So this might seem like an overkill. But if you are after a repeatable, reliable, fast, logging scripting solution, then you are on the right side with rsync.

Here's another example:

And of course, GoogleSearch will teach you a lot more.

Use robocopy to copy multiple files

Robocopy is a built in comprehensive copy tool for Windows.

  • open command line - Windows key + R
  • enter "cmd" (without "")
  • press Enter
  • command window opens

Now you can enter your command. The base robocopy syntax is: robocopy %source path% %destination% *.*

robocopy c:\windows\temp c:\windows *.* /E
option /E to copy full folder structure - inclusive empty ones

A simple use case would be copying files for daily backup:
robocopy C:\Users c:\Backup\%date% *.* /MIR /LOG:backup.log
option /MIR copies empty folders and deletes files in destination path if no longer present in source path

to rerun the script. open a text editor and save the command to a batch file, e.g. backup.bat

See help for more options run robocopy /? in command window.