Robocopy is a powerful, robust, and Windows-native command-line tool for copying files, folders, and even syncing directories — especially useful for backup, migration, or bulk copying.


✅ Robocopy Basics

robocopy [source] [destination] [/options]

🎯 Example: Copy a Folder and All Its Files

✅ Basic Copy (with subfolders)

robocopy "C:\SourceFolder" "D:\DestinationFolder" /E /COPY:DAT /R:10 /W:5

🔍 Breakdown of Options

OptionDescription
/ECopy subdirectories and empty directories too.
/COPY:DATCopy data, attributes, and timestamps — preserves file metadata.
/R:10Retry up to 10 times if a file fails to copy.
/W:5Wait 5 seconds between retries.
/LOG+:C:\backup.logLog output to a file — useful for debugging or tracking.
/ZCopy files even if they’re open (useful for files being used by programs).

🧩 Example: Copy with Logging

robocopy "C:\SourceFolder" "D:\DestinationFolder" /E /COPY:DAT /R:10 /W:5 /LOG+:C:\backup.log

This logs the copy operation to C:\backup.log.


📌 Example: Copy Without Overwriting

robocopy "C:\SourceFolder" "D:\DestinationFolder" /E /COPY:DAT /R:10 /W:5 /Z /COPY:DAT

This copies files without overwriting — if a file already exists, it will not overwrite it.


📂 Example: Copy with Overwrite (Default)

robocopy "C:\SourceFolder" "D:\DestinationFolder" /E /COPY:DAT /R:10 /W:5

This copies all files — and overwrites existing files.


🧠 Pro Tips

  • Use /LOG+:C:\backup.log to track what’s copied — very useful for debugging.
  • Use /Z if you’re copying files that are being used (e.g., by a program).
  • Use /COPY:DAT to preserve file metadata (timestamps, permissions, etc.).
  • Use /E to copy empty directories too.

📄 Example: Copy a Folder with Logging

robocopy "C:\SourceFolder" "D:\DestinationFolder" /E /COPY:DAT /R:10 /W:5 /LOG+:C:\backup.log

🚫 Common Mistakes

  • robocopy C:\Folder D:\FolderWrong! You must specify the folder name.
  • robocopy C:\Folder\ D:\Folder\ /EWrong! You need to specify the folder name.
  • robocopy C:\Folder\ D:\Folder\ /E /IWrong! You need to specify the folder name.

✅ Correct: `robocopy “C:\Folder” “D:\

I hope this helps you as much as it has helped me with my Windows backups.

By Anthony