• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 931
  • Last Modified:

Robocopy and the MOT switch for scheduled jobs

We are planning on using robocopy to copy the contents of an entire directory from one server to another but it must be run once a day at 10 PM.  I have looked into the MOT switch but I have two questions:

1. How can I make robocopy run at 10 PM exactly?  The MOT switch identifies the minimum time in minutes that must elapse before running again.  In order to accomplish this do I have to start robocopy at 10 PM and then set the /MOT:m value to 1440?  I saw something on using the /RH switch, but how exactly would we implement it for our purpose?

2. What if the server is rebooted?  Does robocopy start up automatically?  I doubt it, so how do I ensure my special robocopy.exe command is started every 24 hours?

1 Solution
To run it at 10 exactly, and to make sure it continues to run after a reboot, it's best to use the task scheduler.
Either do it with the "GUI" task scheduler, where you can specify an account to run the command (to provide the network credentials), or use "at.exe" from the command line. If in doubt, I prefer the latter one, it's somewhat more reliable.
For this to work with at.exe, you need a small batch script (which should be put into a folder secured with NTFS permissions to allow only administrators access, as you need to specify a password in it):

net use \\OtherServer\IPC$ password /user:SomeDomain\SomeUser
robocopy T:\hisS\erver \\OtherServer\SomeShare ...
net use \\OtherServer\IPC$ /delete

the at command should be something like
at 10:00pm /every:m,t,w,th,f,s,su C:\Secure\folder\robocopy-script.cmd

(Don't rely on me with the time format, I'm using military time ...)
djs120Author Commented:
Thanks, the task scheduler is where it's at.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now