Robocopy Job Template

A safer starting point for repeatable Windows file copy jobs with logging and dry-run review.

Good For

  • file share migration
  • scheduled copy jobs
  • backup staging
  • large folder moves

How to Use It

  1. Run with `/L` first so Robocopy lists what it would copy without changing files.
  2. Review source, destination, exclusions, retry count, and log path.
  3. Avoid `/MIR` until you have explicitly accepted delete behavior.
  4. Run the real copy with logging enabled.
  5. Review Robocopy exit codes instead of treating every nonzero code as failure.

Execution Modes

  • local

Inputs and Outputs

Inputs

  • source path
  • destination path
  • exclusions
  • log path

Outputs

  • verbose-console
  • log-file

Command Starter

Example pattern only. Adjust for your environment before running.

# Minimal Robocopy quick-start template.
$Source = 'C:\Source'
$Destination = '\\server\share'
$PreviewLog = 'C:\Temp\robocopy-preview.log'
$RunLog = 'C:\Temp\robocopy-run.log'

# Dry-run preview. /L lists work only and does not copy or delete.
& robocopy $Source $Destination /E /L /R:2 /W:5 /TEE /LOG:$PreviewLog

# Approved copy execution. This changes the destination path.
& robocopy $Source $Destination /E /R:2 /W:5 /COPY:DAT /DCOPY:DAT /TEE /LOG:$RunLog
$LASTEXITCODE

Validation

  • Preview log matches the intended copy scope.
  • Run log shows acceptable exit code and copied/skipped counts.
  • Destination permissions and sample files open correctly.

Reporting

  • Use this as the minimal template when you need a preview plus one approved copy run.
  • Use the richer Robocopy job template and log parser page when you need evidence parsing and migration reporting.

Safety Notes

  • Preview with `/L` before copying.
  • Avoid `/MIR` until delete behavior is explicitly approved.