The Robocopy Command Builder generates ready-to-run robocopy commands for Windows backup, file copy, and folder synchronization tasks without memorising switches. Choose a preset for common scenarios — mirror backup, incremental sync, network-resilient copy — enter your source and destination paths, and get a validated command with a plain-English explanation of what it will do.
Advanced mode gives full control over copy flags (data, attributes, timestamps, ACLs, owner, auditing), file and folder exclusions, retry behaviour, thread count, and log output. The command updates in real time as you change options. All processing happens in the browser — no data is sent to a server.
What is robocopy and when to use it
Robocopy (Robust File Copy) is a built-in Windows command-line tool used for file copying, backup, and folder synchronization. It is widely used by system administrators for transferring large datasets, performing incremental backups, and working with network shares.
Unlike basic copy tools, robocopy supports retry logic, multithreading, and preservation of file permissions. However, its large number of switches makes it difficult to use without documentation — which is where a command builder becomes useful.
How to use
Quick mode
- Select a preset that matches your scenario. Each preset shows a short description of what it does.
- Enter the Source path — the folder you want to copy from. Use a local path such as
C:\Dataor a UNC path such as\\server\share. - Enter the Destination path — the folder to copy into. It will be created automatically if it does not exist.
- The generated command and an explanation of its switches appear on the right. Click Copy to copy the command to your clipboard.
Advanced mode
- Enter Source and Destination paths at the top. Optionally add a file filter such as
*.docx *.xlsxto copy only specific file types. - Under What to copy, toggle the copy behaviour — subdirectories, mirror, move, or purge.
- Under Copy flags, select which file properties to copy. The default (D, A, T) covers data, attributes, and timestamps. Add S and O to preserve NTFS permissions and ownership.
- Optionally exclude files or folders by entering space-separated masks or folder names under Exclude.
- Adjust retry count and wait time under Retry & wait, and set the thread count and log file path under Performance & logging.
- The right panel updates the command and explanation in real time. Click Copy when ready.
Frequently asked questions
Frequently asked questions
Robocopy (Robust File Copy) is a command-line file copying tool built into Windows since Vista. It supports recursive directory copies, retry on failure, multithreaded copying, file attribute and permission preservation, and incremental sync. It is the standard choice for reliable file copy tasks in Windows environments, replacing the older xcopy command.
/E copies all subdirectories including empty ones, but does not delete anything in the destination. /MIR does the same as /E and also deletes files and directories from the destination that no longer exist in the source — making the destination an exact mirror of the source. Use /MIR when you want a true backup copy and use /E when you only want to add or update files without removing anything.
/PURGE deletes files and directories from the destination that no longer exist in the source, without copying any subdirectories. /MIR combines /E (copy all subdirectories including empty ones) and /PURGE in a single switch. If you already have /MIR enabled, adding /PURGE is redundant — the builder will warn you about this.
Copy flags control which file properties are transferred alongside the file data. The default set — D (data), A (attributes), T (timestamps) — is appropriate for most backup and copy tasks. Add S (security/ACLs) and O (owner) when you need to preserve NTFS permissions, for example when migrating a file server or copying between volumes on the same domain. Add U (auditing) only when replicating audit configurations. Copying ACLs and owner info requires sufficient privileges on both source and destination.
The default in this builder is 8 threads, which works well for most local and fast network copies. For local disk-to-disk copies on an SSD, values between 8 and 32 tend to give the best throughput. For slow or unstable network paths, lower values (2–4) reduce the risk of saturating the link or triggering errors. The maximum is 128. Note that /MT is not compatible with /IPG (inter-packet gap) and may produce inconsistent results when combined with /LOG without /NP.
/R:N sets how many times robocopy retries a failed file copy before skipping it. /W:N sets how many seconds to wait between retry attempts. The Windows default for both is 1,000,000 retries with 30 seconds wait — which means a single locked file can stall a job for days. Setting /R:3 /W:5 is a practical starting point for most tasks. Use /R:0 for fast local copies where retrying is not useful.
Restartable mode saves the copy state for each file as it is being written. If the connection drops mid-copy, robocopy can resume from where it left off rather than starting the file again from the beginning. This is particularly useful for large files over slow or unreliable network connections. Restartable mode is slower than normal mode for small files, so it is enabled only in the Network resilient preset.
Yes. Robocopy is a native Windows executable and runs in both Command Prompt and PowerShell. Paste the command directly into either shell. In PowerShell, paths with spaces are already quoted by the builder. Robocopy returns exit codes that indicate the result of the operation — exit code 0 means no files were copied (destination already up to date), 1 means files were copied successfully, codes 8 and above indicate errors. In PowerShell scripts, check $LASTEXITCODE after the robocopy call.
Practical examples
Daily mirror backup of a documents folder
Select the Mirror backup preset, set source to your documents folder and destination to a backup drive, then schedule the generated command with Task Scheduler:
robocopy "C:\Users\Zaur\Documents" "D:\Backup\Documents" /MIR /R:3 /W:5 /NP /LOG:"D:\Backup\logs\documents.log"
/MIR will delete files in the destination that no longer exist in the source. Make sure the destination is a dedicated backup location and not a shared folder.
Copy files from a network share preserving NTFS permissions
Use Advanced mode, enable Include subdirectories, and add the S and O copy flags to preserve ACLs and ownership during a file server migration:
robocopy "\\OldServer\Finance" "\\NewServer\Finance" /E /COPY:DATO /R:5 /W:10 /MT:4 /NP /LOG:"C:\Logs\migration.log"
/COPY:S) requires the account running robocopy to have SeBackupPrivilege on the source and SeRestorePrivilege on the destination. Run the command as an administrator or a service account with those rights.
Incremental sync excluding temp and log files
Use Advanced mode with Include subdirectories enabled, add exclusion masks for temporary and log files, and keep the retry values low for a fast local copy:
robocopy "C:\Projects" "E:\ProjectsBackup" /S /XF *.tmp *.log ~* /XD .git node_modules /R:1 /W:2 /MT:16 /NP
Run robocopy as a scheduled task in PowerShell
Wrap the generated command in a PowerShell script to handle exit codes correctly — robocopy uses non-zero exit codes even on success:
robocopy "C:\Data" "D:\Backup\Data" /MIR /R:3 /W:5 /NP /LOG:"D:\Backup\logs\data.log"
if ($LASTEXITCODE -le 7) {
Write-Host "Robocopy completed successfully (exit code $LASTEXITCODE)"
exit 0
} else {
Write-Error "Robocopy failed with exit code $LASTEXITCODE"
exit 1
}
Useful links
- Robocopy — Microsoft documentation
- Robocopy reference — SS64
- Task Scheduler — Microsoft documentation