The Job and Monitoring Options of RoboCopy

What does the Job Options of RoboCopy do? And what exactly does the /MON and /MOT switches do? How can I use them? I don't understand them, and can't find any examples on how to use them.

  • /MON:n - MONitor source; run again when more than n changes seen.
  • /MOT:m - MOnitor source; run again in m minutes Time, if changed.

Does this mean that it will run one time first and then keep running after it finishes and run again if a change happens somewhere down in the filestructure or when something have changed and a time has passed?

  • /JOB:jobname - take parameters from the named JOB file.
  • /SAVE:jobname - SAVE parameters to the named job file
  • /QUIT - QUIT after processing command line (to view parameters).
  • /NOSD - NO Source Directory is specified.
  • /NODD - NO Destination Directory is specified.
  • /IF - Include the following Files.

What is a job file? What is the /NOSD and /NODD switches for?


Does this mean that it will run one time first and then keep running after it finishes and run again if a change happens somewhere down in the filestructure or when something have changed and a time has passed?

Yes. /MON counts number of files changed; /MOT counts time.

I've been afraid to ever try these options, since the docs say how to START these jobs, but not how to STOP them. They might become invisible, unstoppable scheduled tasks, for all I know.

This page indicates it runs until you interrupt the running job, e.g., with control-C.

(Added as an answer instead of as a comment, because StackExchange doesn't allow me to write comments without 50 reputation, and I have 1 reputation after 3 years.)


Best explained by example:

Here's a trivial job file, call it sample.rcj:

:: Source Directory :
    /SD:C:\Documents and Settings\  :: Source Directory.

:: Destination Directory :
::  On command line

:: Copy options :
    /E      :: copy Subdirectories, including empty ones.

It specifies options to copy the c:\Documents and Settings directory of the current machine to an unspecified location.

Here's how you'd use it to copy to the destination specified in the %DEST% environment variable, adding logging to the %LOG% file.

robocopy /nosd %DEST% /log+:%LOG% /job:sample

/NOSD is given because the source is specified in the job file.

You can play around with creating a robocopy command on the command line, then when you're happy it's doing what you want, run it again with /SAVE to save the options to a file.

/QUIT parses the options and will complain if you've got something wrong (invalid options, source doesn't exist) but doesn't actually do anything.

I would guess that /IF would let you include a file of options in addition to the job itself? (In my example, I could have put the /LOG option in a file and included it with /IF.) Just guessing there, though.


/MON scans the source and copies when it detects changes. /MOT reruns again in n minutes, and copies any detected changes

/JOB allows you to specify the options in a text file, in the event you have lots of options (like exclusions).

Wish I knew what /NOSD and /NODD did as I have never had a reason to use them.


From: http://www-pc.uni-regensburg.de/systemsw/tools/robocopy.doc

Monitoring a Directory Tree Using the /MON:n and /MOT:m switches you can Monitor the source directory tree for changes, and copy changes as and when they occur. The /MON:n switch specifies the minimum number of changes that must occur before running again. The /MOT:m switch specifies the minimum time, in minutes, that must elapse before running again. If you only specify one of these switches, the other is assumed to have a value of 1.

When Monitoring is specified, Robocopy never terminates. Instead, it enters a loop that performs a normal Robocopy pass and then monitors the source directory tree for changes, until both n changes have been detected and m minutes have elapsed. When both conditions are met, another Robocopy pass is started. This whole process of copying and monitoring is repeated, ad infinitum, until the user manually terminates the Robocopy process.

As a minimum, Robocopy monitors the source directory tree for changes to file and directory names, sizes, and last write times. If attributes are to be copied Robocopy will also monitor the tree for attribute changes. Similarly, if security information is to be copied, Robocopy will also monitor the tree for security changes.

Consequently, a user performing an edit and saving a single new file, for example, may cause multiple changes of various types to be reported back to Robocopy. Therefore some experimentation may be required to determine appropriate threshold values for /MON and /MOT for each Robocopy job, especially those monitoring busy trees.