Robocopy job template and log parser

A safer Robocopy job template with dry-run review, log capture, exit-code interpretation, and migration evidence.

Good For

  • file share migration
  • large copy jobs
  • backup staging
  • scheduled transfer review
  • copy failure evidence

How to Use It

  1. Start with a preview command that includes `/L` so Robocopy lists intended work without copying or deleting files.
  2. Review source, destination, exclusions, retry behavior, and whether permissions, timestamps, or owner data should be copied.
  3. Avoid `/MIR` unless delete behavior has explicit approval and a restore path.
  4. Run the real copy with `/TEE` and a log file so console output and durable evidence are both captured.
  5. Parse the run log and exit code before deciding whether the job succeeded, partially succeeded, or needs rerun.
  6. Store preview and run logs with the migration or backup ticket.

Execution Modes

  • local
  • remote-single-host
  • remote-host-list

Inputs and Outputs

Inputs

  • source path
  • destination path
  • CSV or TXT job list
  • exclusion list
  • log path

Outputs

  • verbose-console
  • log-file
  • csv
  • future-html-report

Command Starter

Example pattern only. Adjust for your environment before running.

robocopy C:\Source \\server\share /E /L /R:2 /W:5 /TEE /LOG:C:\Temp\robocopy-preview.log
robocopy C:\Source \\server\share /E /R:2 /W:5 /COPY:DAT /DCOPY:DAT /TEE /LOG+:C:\Temp\robocopy-run.log
Select-String -Path C:\Temp\robocopy-run.log -Pattern 'Dirs :','Files :','Bytes :','Times :','Ended :'

Validation

  • Preview log matches the intended source, destination, and exclusion scope.
  • Run log shows acceptable copied, skipped, failed, and mismatch counts for the job goal.
  • Sample files open from the destination and permissions behave as expected.

Reporting

  • attach preview and run logs to migration tickets
  • summarize exit codes and failed file counts in an operator note
  • promote repeated use into a copy-job evidence report

Safety Notes

  • Preview with `/L` before copying.
  • Treat `/MIR`, `/PURGE`, and overwrite-heavy jobs as change-window work with backup or restore evidence.
  • Keep the previous source available until destination validation and owner signoff are complete.