RoboCopy
by KevinA of Microsoft    Download

This utility from Microsoft enables you to back up many folders from one drive to another in an intelligent way.  It does not waste time copying files that have not changed.  It copies only the files with a newer date and time over the older ones.

You can put the command in a BAT file to make it easier.  For example, if "MyDocs" is the folder you want to back up from the C: drive to the D: drive, type::

C:> C:
C:> cd MyDocs
C:> RoboCopy C:\MyDocs D:\MyDocs /mir

The "/mir" means to mirror the folders, so that they are the same as the C: version.  There are many other "/ options" you can read at the Microsoft page (or see below).

You can also use this with the AT command to AuTomatically backup AT a certain time, such as 2:00 am.  From DOS, type
at 02:00:00 /every:m,t,w,th,f,s,su RoboCopy C:\MyDocs D:\MyDocs /mir

You can verify the command by typing   AT

Note that the source and destination do not have to be identical, but usually you would want them to be.  In the following example, all the c:\imail files will copy to the d:\mydocs folder. 

Status ID Day Time Command Line
---------------------------------------------------------------
1 Each M T W Th F S Su 2:00 AM robocopy c:\imail d:\mydocs /mir

To delete this scheduled task, type
at 1 /delete

 

-------------------------------------------------------------------------------
ROBOCOPY v 1.71  :  Robust File Copy for Windows NT  :  by kevina@microsoft.com
-------------------------------------------------------------------------------

  Started : Fri Oct 19 15:58:31 2001

             Usage : ROBOCOPY source destination [file [file]...] [options]

            source : Source Directory (drive:\path or \\server\share\path).
       destination : Destination Dir  (drive:\path or \\server\share\path).
              file : File(s) to copy  (names/wildcards - default is "*.*").

options :       /S : copy Subdirectories, but not empty ones.
                /E : copy subdirectories, including Empty ones.

                /T : Timestamp all destination files, including skipped files.

              /R:n : number of Retries on failed copies - default is 1 million.
              /W:n : Wait time between retries - default is 30 seconds.
              /REG : Save /R:n and /W:n in the Registry as default settings.

              /TBD : wait for sharenames To Be Defined (retry error 67).
              /FAT : create destination files using 8.3 FAT file names only.

                /X : report all eXtra files, not just those selected.
                /V : produce Verbose output, showing skipped files.
                /L : List only - don't copy, timestamp or delete any files.

  /A+:[R][A][S][H] : add the given Attributes to copied files.
  /A-:[R][A][S][H] : remove the given Attributes from copied files.

  /XA:[R][A][S][H] : eXclude files with any of the given Attributes
                /A : copy only files with the Archive attribute set.
                /M : like /A, but remove Archive attribute from source files.

/XF file [file]... : eXclude Files matching given names/paths/wildcards.
/XD dirs [dirs]... : eXclude Directories matching given names/paths.

   /XC | /XN | /XO : eXclude Changed | Newer | Older files.
         /XX | /XL : eXclude eXtra | Lonely files and dirs.
               /IS : Include Same files.

                /Z : Copies files in restartable mode.
               /NP : No Progress - don't display % copied.
              /ETA : show Estimated Time of Arrival of copied files.
             /MOVE : Move files and dirs (delete from source after copying).
            /PURGE : delete dest files/dirs that no longer exist in source.


AT Command - Automatic Timer

The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.
If it is not a .EXE you must precede it with cmd /c

Sample Batch Files

It is suggested that you use the AT command with a Batch file, so you can test the Batch file separately before putting it on automatic execution.

This backs up all the Web Site Log Files from the C: drive to the D: drive using Microsoft's RoboCopy command.  It keeps a record of its activity in RoboCopy.Txt

rem Copy Log Files from C: to D:\_LogFiles
C:
cd \WINNT\System32\LogFiles

rem make a backup for analysis
copy RoboCopy.Txt RoboCopy.Bak

RoboCopy C:\WINNT\System32\LogFiles D:\_LogFiles /s /log:C:\RoboCopy.Txt

:END
NotePad C:\RoboCopy.Txt
 

This backup up all the Web sites from the D: drive to the T: drive on another server.  It first checks to see if the T: is mapped.

rem This backs up all the Web sites from D: to T: on another server

if not exist T:\HTTP\NETSTAT.BAT goto END

D:
cd \HTTP

rem make a backup for analysis
copy D:\RoboCopy.Txt D:\RoboCopy.Bak

RoboCopy D:\HTTP T:\HTTP /s /mir /log:D:\RoboCopy.Txt

:END
NotePad D:\RoboCopy.Txt
 

The above BAT files would be activated with the following AT commands.

Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Each M T W Th F S Su 2:00 AM cmd/c D:\HTTP\COPY_D_T.Bat

2 Each M T W Th F S Su 1:00 AM cmd/c C:\WINNT\System32\LogFiles\LogF_C_D.bat
 

Screen Shot of RoboCopy In Action

Here the AT command has launched the COPY_D_T.BAT file.  It does not display what it is doing because all the activity is being saved in the D:\RoboCopy.Txt file for later viewing.


A batch file to set up an AT command for a backup every 10 minutes

at /delete
at 01:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 01:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 01:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 01:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 01:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 01:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 02:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 02:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 02:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 02:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 02:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 02:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 03:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 03:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 03:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 03:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 03:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 03:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 04:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 04:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 04:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 04:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 04:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 04:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 05:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 05:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 05:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 05:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 05:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 05:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 06:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 06:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 06:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 06:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 06:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 06:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 07:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 07:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 07:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 07:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 07:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 07:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 08:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 08:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 08:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 08:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 08:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 08:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 09:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 09:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 09:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 09:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 09:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 09:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 10:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 10:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 10:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 10:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 10:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 10:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 11:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 11:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 11:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 11:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 11:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 11:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 12:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 12:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 12:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 12:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 12:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 12:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 13:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 13:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 13:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 13:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 13:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 13:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 14:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 14:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 14:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 14:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 14:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 14:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 15:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 15:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 15:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 15:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 15:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 15:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 16:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 16:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 16:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 16:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 16:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 16:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 17:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 17:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 17:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 17:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 17:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 17:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 18:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 18:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 18:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 18:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 18:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 18:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 19:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 19:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 19:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 19:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 19:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 19:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 20:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 20:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 20:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 20:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 20:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 20:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 21:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 21:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 21:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 21:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 21:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 21:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 22:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 22:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 22:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 22:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 22:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 22:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 23:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 23:10:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 23:20:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 23:30:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 23:40:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 23:50:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT
at 00:00:00 /every:m,t,w,th,f,s,su cmd /c W:\Copy_W_D.BAT

 

C I Corporation

.