Skip to content

Robocopy Switches and Presets

Andrew Paolucci edited this page Nov 19, 2026 · 1 revision

Robocopy Switches & Built-In Presets

robocopy2rust-core models the complete Windows 10/11 Microsoft Robocopy switch set across RobocopyJob (model.rs), formats arguments deterministically (command.rs), and round-trips commands and .rcj files cleanly (parser.rs, rcj.rs).

Important Default Difference vs. Raw robocopy.exe: Raw robocopy.exe defaults to /R:1000000 (1 million retries) and /W:30 (30 seconds wait), causing locked files to hang jobs for days. RobocopyJob::default() applies safer defaults: /E /MT:8 /R:3 /W:5 /ETA. When parsing an external CLI command or .rcj file, RobocopyJob::empty_cli_defaults() is used instead so only explicit switches appear.


Complete Supported Switch Reference

1. Copy & Transfer Switches (CopyOptions)

Switch CopyOptions Field Description
/S subdirectories_non_empty Copy subdirectories, excluding empty directories
/E subdirectories_including_empty Copy subdirectories, including empty directories (superseded by /MIR if enabled)
/LEV:n max_levels Copy only the top n levels of the source directory tree
/Z restartable Copy files in restartable mode
/B backup_mode Copy files in Backup mode (uses SeBackupPrivilege / SeRestorePrivilege)
/ZB restartable_or_backup Use restartable mode; if access is denied, fall back to Backup mode
/J unbuffered_io Copy using unbuffered I/O (recommended for very large files / NVMe)
/EFSRAW efs_raw Copy encrypted files in EFS RAW mode (incompatible with /MT and /LFSM)
/COPY:<flags> copy_flags File properties to copy: D (Data), A (Attributes), T (Timestamps), S (Security/ACLs), O (Owner), U (Auditing), X (Skip Alt Data Streams). Automatically formats /COPYALL (DATSOU) or /SEC (DATS) when matched
/NOCOPY no_copy Copy no file info (useful with /PURGE)
/SECFIX sec_fix Fix file security on all files, even skipped files
/TIMFIX tim_fix Fix file times on all files, even skipped files
/PURGE purge Destructive: Delete destination files/directories that no longer exist in source
/MIR mirror Destructive: Mirror directory tree (equivalent to /E + /PURGE)
/MOV move_files Destructive: Move files (delete from source after copying)
/MOVE move_files_and_dirs Destructive: Move files and directories (delete from source after copying)
/A+:<attrs> add_attributes Add DOS/NTFS attributes (R A S H C N E T O) to copied files
/A-:<attrs> remove_attributes Remove DOS/NTFS attributes (R A S H C N E T O) from copied files
/CREATE create_tree_only Create directory tree and zero-length placeholder files only
/FAT fat_names Create destination files using 8.3 FAT filenames only
/256 disable_long_paths Turn off long path (> 256 characters) support
/MON:n monitor_changes Monitor source; run again when more than n changes are seen
/MOT:m monitor_minutes Monitor source; run again in m minutes if changed
/RH:hhmm-hhmm run_hours Run hours window (24-hour HHMM-HHMM, e.g., 2200-0600)
/PF per_file_run_hours Check run hours per file rather than per pass
/IPG:n inter_packet_gap_ms Inter-packet gap (n ms) to free bandwidth on slow lines (incompatible with /MT)
/SJ copy_junctions Copy junctions as junctions instead of the junction targets
/SL copy_symlinks Copy symbolic links versus targets (Windows 10/11 behavior)
/MT[:n] multithreaded Multi-threaded copying (1..=128 threads; incompatible with /IPG, /EFSRAW, /LFSM)
/DCOPY:<flags> dir_copy_flags Directory properties to copy: D (Data), A (Attributes), T (Timestamps), E (Extended Attributes), X (Skip Alt Data Streams). Default DA
/NODCOPY no_dir_copy Copy no directory info
/NOOFFLOAD no_offload Copy files without Windows Copy Offload mechanism
/COMPRESS network_compress Request SMB network compression during transfer (Windows 10/11 / Server)
/SPARSE:Y|N sparse_mode Preserve sparse state (Y) or disable sparse copying (N)
/NOCLONE no_clone Disable ReFS block cloning during copy

2. I/O Throttling Switches (ThrottleOptions — Windows 10/11)

Switch ThrottleOptions Field Description
/IoMaxSize:n[KMG] io_max_size Requested max I/O size per read/write cycle (e.g., 64K, 1M)
/IoRate:n[KMG] io_rate Requested max I/O rate per second (e.g., 50M, 100K)
/Threshold:n[KMG] threshold Minimum file size threshold before /IoRate throttling kicks in

3. File Selection & Exclusion Switches (FileSelectionOptions)

Switch FileSelectionOptions Field Description
/A archive_only Copy only files with the Archive attribute set
/M archive_and_reset Copy only files with the Archive attribute set and reset it
/IA:<attrs> include_attrs Include only files with any of the specified attributes (RASHCNETO)
/XA:<attrs> exclude_attrs Exclude files with any of the specified attributes (RASHCNETO)
/XF <patterns...> exclude_files Exclude files matching names/paths/wildcards (placed cleanly after scalar switches)
/XD <dirs...> exclude_dirs Exclude directories matching names/paths (normalized via normalize_robocopy_path)
/XC exclude_changed Exclude Changed files
/XN exclude_newer Exclude Newer files
/XO exclude_older Exclude Older files
/XX exclude_extra Exclude Extra files and directories
/XL exclude_lonely Exclude Lonely files and directories
/IS include_same Include Same files (overwrite identical destination files)
/IT include_tweaked Include Tweaked files
/IM include_modified Include Modified files (differing timestamps)
/MAX:n max_size_bytes Maximum file size in bytes (exclude larger files)
/MIN:n min_size_bytes Minimum file size in bytes (exclude smaller files)
/MAXAGE:n max_age Exclude files older than n days or YYYYMMDD date
/MINAGE:n min_age Exclude files newer than n days or YYYYMMDD date
/MAXLAD:n max_last_access Exclude files unused since n (days or YYYYMMDD)
/MINLAD:n min_last_access Exclude files used since n (days or YYYYMMDD)
/FFT fat_file_times Assume FAT file times (2-second granularity) for NAS/Samba/FAT targets
/DST compensate_dst Compensate for one-hour DST time differences
/XJ exclude_junctions Exclude all junction points and symbolic links
/XJD exclude_dir_junctions Exclude junction points for directories only
/XJF exclude_file_symlinks Exclude symbolic links for files only

4. Retry & Low Free Space Switches (RetryOptions)

Switch RetryOptions Field Description
/R:n retries Number of retries on failed copies (default 3 in robocopy2rust)
/W:n wait_seconds Wait time between retries in seconds (default 5 in robocopy2rust)
/REG save_defaults_to_registry Save /R:n and /W:n to registry as default settings
/TBD wait_for_sharenames Wait for sharenames to be defined (retry error 67)
/LFSM[:n[KMG]] low_free_space_mode / low_free_space_floor Operate in Low Free Space Mode; pause automatically when free space drops below n floor (incompatible with /MT and /EFSRAW)

5. Logging & Job File Switches (LoggingOptions, JobFileOptions)

Switch Field Description
/L logging.list_only List only — simulate without copying, timestamping, or deleting files (Dry-Run)
/X logging.report_extra Report all Extra files, not just selected ones
/V logging.verbose Produce verbose output showing skipped files
/TS logging.include_timestamps Include source file timestamps in output
/FP logging.full_paths Include full path names of files in output
/BYTES logging.sizes_in_bytes Print sizes as exact bytes
/NS / /NC no_sizes / no_classes Suppress file sizes (No Size) or file classes (No Class)
/NFL / /NDL no_file_list / no_dir_list Suppress logging of file names or directory names
/NP logging.no_progress Suppress % copied progress updates
/ETA logging.show_eta Show Estimated Time of Arrival of copied files
/LOG:path / /LOG+:path log_mode + log_path Write (or append +) ANSI/UTF-8 log to file
/UNILOG:path / /UNILOG+:path log_mode + log_path Write (or append +) Unicode (UTF-16LE) log to file
/TEE logging.tee Output to console window as well as the log file
/NJH / /NJS no_job_header / no_job_summary Omit Robocopy Job Header (No Job Header) or Summary (No Job Summary)
/UNICODE logging.unicode_output Output status as Unicode
/JOB:name / /SAVE:name load_job / save_job Load parameters from or save parameters to a .rcj job file
/QUIT job_files.quit_after_parse Quit after processing command line (for exporting .rcj jobs cleanly)
/NOSD / /NODD no_source_dir / no_dest_dir Omit source directory or destination directory specification

(Note: Both /SD: and /DD: seen in pasted .rcj snippets are also accepted seamlessly by parse_command_line.)


8 Built-In Presets (crates/robocopy2rust-core/src/presets.rs)

Applying any preset in either GUI (apply_preset_preserving_paths) preserves your currently entered Source and Destination paths. Verified via unit test to emit zero validation errors once paths are populated:

Preset ID Display Name Category Destructive Core Switches Configured Use Case
safe-backup Safe Incremental Backup Backup No /E /MT:8 /XJ /R:3 /W:5 /ETA Everyday incremental backup without deletions
exact-mirror Exact Directory Mirror Mirror Yes /MIR /MT:8 /XJ /R:3 /W:5 Exact 1:1 mirror (purges destination files missing from source)
dry-run-preview Dry-Run Preview (/L) Audit No /E /MT:8 /XJ /L /X /V /FP /BYTES Zero-write tree comparison previewing every copy/extra/skip
fast-nvme Fast LAN / NVMe Bulk Transfer Performance No /E /J /MT:32 /XJ /R:2 /W:2 /NP Maximum throughput multi-threaded unbuffered large-media transfer
enterprise-migration Enterprise File Server Migration Enterprise No /E /ZB /COPYALL /DCOPY:DAT /MT:16 /XJ /R:5 /W:10 /FP /TS Preserves NTFS ACLs, owners, auditing, and directory timestamps
move-archive Move & Archive (/MOVE) Move Yes /E /MOVE /MT:8 /XJ /R:3 /W:5 Moves files and subdirectories and removes source copies once verified
wan-sync Low-Bandwidth WAN Sync Network No /E /Z /COMPRESS /IPG:20 /FFT /XJ /R:10 /W:15 /TBD Restartable, SMB-compressed VPN/WAN sync (/MT omitted because /MT conflicts with /IPG)
lfsm-safe Low Free Space Safe Copy (/LFSM) Safety No /E /XJ /R:5 /W:10 /LFSM:1G Pauses automatically below 1G free space (/MT omitted because /MT conflicts with /LFSM)

Clone this wiki locally