Log back-up using Windows Robocopy

Introduction

Window’s robust copy (robocopy) command can be used to reliably back-up files. Scheduling a robocopy script is a very effective method for backing up Iguana log files (or other files).

Note: The screenshots on this page are from Windows 10 — the screens will vary somewhat for different versions of Windows.

Task [top]

Schedule Windows robocopy to backup iguana log files.

Implementation [top]

Create a batch file (using the robocopy command) and schedule to run at particular time(s) using the Windows Task Scheduler.

Follow these steps to schedule a robocopy backup:

  1. Create a robocopy-backup batch file:
    1. Create a robocopy command similar to this one which copies files from a source directory (like: C:\IguanaLogs) to a destination drive (like: \\NAS\backupfolder).

      robocopy C:\IguanaLogs \\NAS\backupfolder /ZB /MINAGE:30 /LOG+:\\NAS\backuplog.txt /TEE /NP

    2. Save the command in a file named Iguana_log_backup.bat or similar.
  2. Open the Windows Task Scheduler:
    1. Type “scheduler” (or “task”) in Windows Search and select the Task Scheduler:
      windows 10 search scheduler
  3. Create a new Basic Task:
    windows scheduler create basic task

    Tip: The Basic Task option uses a Wizard to create the task — if you prefer a a more comprehensive tabbed “properties style” view you can choose Create Task instead.

  4. Follow the steps in the Task Wizard:
    1. Use a name like Iguana_log_backup or similar.
    2. Use a daily Trigger:
      windows scheduler trigger
    3. We recommend scheduling the backup to start during off-peak hours, like 3 am:
      windows scheduler start time
    4. Choose the Action to Start a program:
      windows scheduler action
    5. Choose to run your robocopy batch file you created above:
      windows scheduler choose program
    6. And then click Finish to save your new scheduled task.
  5. And that’s it you’re done — task created!

How it works [top]

We use a robocopy command to copy the Iguana log files to a remote disk device. The robocopy command is saved as a batch file and then scheduled to run at particular time(s) using the Windows Task Scheduler.

Robocopy command options:

  • Source directory –   C:\IguanaLogs
  • Destination directory –  \\NAS\backupfolder
  • /ZB –  Restartable backup mode
  • /MINAGE:30 –   backup all log files older than 30 days
  • /LOG+:\\NAS\backuplog.txt –  Log the results of the backup in backuplog.txt
  • /TEE –  Output to console window and log file
  • /NP –   Reduce progress logging

Tip: You can also schedule the robocopy batch file using other scheduling software if you prefer (some companies may prefer 3rd party scheduling solutions).

More information [top]

 

Leave A Comment?