RoboCopy for Dummies
Synopsis: Robocopy examples
Published June 28th, 2026
Last Modified: June 28th, 2026
Intro: I love Robocopy, and have used it many times. I usually find the last time I ran it, and run it like that, but here is a nice example script with extra notes.
Published June 28th, 2026
Last Modified: June 28th, 2026
Intro: I love Robocopy, and have used it many times. I usually find the last time I ran it, and run it like that, but here is a nice example script with extra notes.
Quick Run Down
-
1.) RoboCopy - Share to Share
2.) RoboCopy - For deleting things
3.) Troubleshooting
RoboCopy Example Script
# Define paths
$source = "C:\Folder\Source" # Source directory
$destination = "\\server\ShareName" # Destination directory
# Log file
$log = "C:\temp\Logs\robocopy.log" # Log file
$args = @(
"/MIR" # Mirror source to destination (adds/updates + deletes extras)
"/ZB" # Restartable mode (resumes interrupted copies), and then backup mode if permission issues
"/R:3" # Retry failed copies 3 times
"/W:5" # Wait 5 seconds between retries
"/COPYALL" # Copy Data, Attributes, Timestamps, NTFS Permissions
"/TEE" # Writes output to console AND log file at the same time
"/LOG:$log" # Append to log file
)
# Run robocopy
robocopy $source $destination $args
RoboCopy - For deleting things
-
PLACE HOLDER
Troubleshooting Tips
- PlaceHolder