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. Expert mode unlocks the full robocopy switch set — file age and size filters, attribute selectors, backup mode, restartable mode, bandwidth throttling, and verbose logging control. Paths entered in any mode carry over automatically when you switch tabs. The command updates in real time. 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, purge, or create directory tree only.
- 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.
Expert mode
Expert mode is for scenarios where Advanced mode does not provide enough control. Paths and file filters carry over automatically from Quick and Advanced — you do not need to re-enter them.
- Under Copy mode, enable restartable mode (
/Z), backup mode (/B), or the combined/ZBwhich tries restartable and falls back to backup mode if access is denied. Use/EFSRAWto copy EFS-encrypted files in raw mode. Enable/256for paths longer than 256 characters, or/LFSMto pause automatically when the destination disk is running low on space. - Under File age filters, set
/MAXAGEto copy only recently modified files (for example, files changed in the last 30 days), or/MINAGEto skip recent files and copy only older ones. Values can be a number of days or a date inYYYYMMDDformat. - Under File size filters, use
/MAXto skip files larger than a given size in bytes, or/MINto skip files smaller than a given size. - Under Attribute filters, use
/IAto copy only files with specific attributes set (for exampleAfor archive-flagged files), or/XAto exclude files with specific attributes (for exampleHto skip hidden files). - Under Performance & logging, use
/IPGto throttle bandwidth on slow WAN links — note this is incompatible with/MT. Use/LOG+to append to an existing log instead of overwriting it. Enable/TEEto write output to both console and log file simultaneously. Use/NFL,/NDL,/NS, and/NCto suppress specific parts of the log output for cleaner results. - The command and explanation on the right update 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 (/Z) saves the copy progress for each file as it is written. If the connection drops mid-copy, robocopy can resume from where it left off rather than starting the file again. This is useful for large files over slow or unreliable network links, but slower than normal mode for small files. Backup mode (/B) bypasses ACL restrictions on the source, allowing robocopy to read files that the current user cannot normally access — useful when copying system files or locked-down directories. /ZB tries restartable mode first and automatically falls back to backup mode if access is denied, making it the most practical choice when you need both resumability and broad file access.
/MAXAGE:N excludes files older than N days (or older than a specific date in YYYYMMDD format), so only recently modified files are copied — useful for differential backups or hot-data migration. /MINAGE:N does the opposite — excludes files newer than N days, useful for archiving files that have not been touched recently. /MAX:N skips files larger than N bytes, and /MIN:N skips files smaller than N bytes — useful when you want to copy only small config files or only large media files from a mixed directory.
Yes. Robocopy is a native Windows executable and runs in both Command Prompt and PowerShell. Paste the command directly into either shell. Paths with spaces are already quoted by the builder. Robocopy returns exit codes that indicate the result — 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 to distinguish success from failure.
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
Copy only files modified in the last 7 days
Use Expert mode and set Max age to 7 to copy only recently modified files — useful for a daily hot-data sync without touching the full archive:
robocopy "C:\Data" "D:\HotBackup" /S /MAXAGE:7 /R:3 /W:5 /MT:8 /NP
Copy system-locked files using backup mode
Use Expert mode and enable /ZB to access files restricted by ACLs or held open by the system — useful when copying from directories with restricted permissions:
robocopy "C:\Windows\System32\config" "D:\SystemBackup\config" /ZB /COPY:DAT /R:3 /W:5 /NP /LOG:"D:\SystemBackup\logs\config.log"
/B and /ZB) requires the account running robocopy to hold the SeBackupPrivilege right. Run the command as an administrator or a dedicated backup service account.
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