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):
http://www.rsync.net/resources/howto/windows_rsync.html

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: http://it-em.net/joomla/index.php?option=com_content&view=article&id=49&...

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% *.*

example:
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.