Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
The Server Admin
The Server Admin
  • Home
  • Linux
  • Windows
  • About
  • What Powers The Server Admin
  • Home
  • Linux
  • Windows
  • About
  • What Powers The Server Admin
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
Windows

Robocopy Examples

By Anthony
February 12, 2026 2 Min Read
0

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:\Folder β€” Wrong! You must specify the folder name.
  • ❌ robocopy C:\Folder\ D:\Folder\ /E β€” Wrong! You need to specify the folder name.
  • ❌ robocopy C:\Folder\ D:\Folder\ /E /I β€” Wrong! 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.

Author

Anthony

Follow Me
Other Articles
Previous

Rsync Command Examples

Next

Mount sFTP folder as local drive

Search

Need a Virtual Server for sysctl testing? Check out our plans!

Popular Posts

  • Mount sFTP folder as local drive
    by Anthony
    June 9, 2026
  • Robocopy Examples
    by Anthony
    February 12, 2026
  • Rsync Command Examples
    by Anthony
    February 10, 2026

Trending

  • Mount sFTP folder as local drive
    by Anthony
    June 9, 2026
  • Adding a GUI to a Server or VPS
    by Anthony
    August 27, 2024
  • Back up to a shared folder with Time Machine on Mac
    by Anthony
    January 4, 2025
  • Backup Your Databases
    by Anthony
    March 24, 2024

Editors Picks

    Send an email:
    mail@example.com

    Call me:
    123-456-7890

    • Facebook
    • Twitter
    • Instagram
    • TikTok
    • LinkedIn
    • Behance
    Copyright 2026 — The Server Admin. All rights reserved. Blogsy WordPress Theme