Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Great questions AND until I saw your tags I hadn't realized robocopy is part of windows 7. :-) –  Chris_K Aug 18 '09 at 19:19
    
Thanks! Think it is part of Vista as well, but I'm using Windows 7, so slapped it on there. I didn't know about this tool at all a couple of days ago :D –  Svish Aug 18 '09 at 20:00
    
Robocopy has been included standard since Windows Vista and Windows Server 2008. Prior to that, it has publicly available since v1.7 as a tool in the Windows Resource Kits since 3.51 (and prior to that, it was known to MS employees as "that awesome copy utility that Kevin wrote...") –  Jessica McKinnon Aug 26 '09 at 17:35

5 Answers 5

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.

share|improve this answer
    
Hmm, so then it can be used to detect renames and moves. But when it does detect such a change in the tree, does it copy the file to the new name/location and delete it from the old (thus performing unnecessary writes), or can it rename/move it? –  Synetech Sep 4 '13 at 19:54

As an example, I use the /MOT switch to keep a DR filesystem up-to-date with a copy every 10 minutes. I start robocopy at 12am with a scheduled task and it runs all day copying any changes every 10min. The scheduled task is set to stop itself after 23h55m and then robocopy is started by the next day's task at 12am again.

Although robocopy does indicate the number of changes as it waits for the 10min period to expire, it still scans the entire source folder structure you've pointed it to. So best to narrow the source structure down with a few folder exceptions (/XD ) if you can.

share|improve this answer
    
Care to share your script? –  Svish Jul 8 '10 at 16:49

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.

share|improve this answer
    
I don't know about the /MON and MOT options, but I suspect that shufler got them right. Try it and let us know! –  Randy Orrison Sep 2 '09 at 12:20
    
ps. more info on this subject here: detroitdavesraves.blogspot.co.uk/2011/08/… –  JohnLBevan Mar 25 '13 at 11:42

Check the documentation in Technet.

share|improve this answer
1  
The documentation there doesn't say anything more than what I put up in my answer there. At least as far as I can see... –  Svish Sep 2 '09 at 11:30
    
I see what you mean, sorry. The documentation was much better before it became an "official" product. –  John Gardeniers Sep 2 '09 at 11:39

/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.

share|improve this answer
    
Could you create an example of using that /JOB switch? I can't get it to work... –  Svish Aug 18 '09 at 20:01
    
the /job file contains a list of switches (one per line) and their parameters. you can also use the /save switch to output a job file (.rcj) for later use –  shufler Aug 20 '09 at 18:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.