XCOPY

Another free tool in your MS Windows system … you can use the tool for moving files around or simple backup. Whatever use you want — it is very easy to use and the command line is very straight forward.

XCOPY source [dest] [/A | /M] [/D[:date]] [/P] [/S]
[/E] [/V] [/W] [/C] [/I] [/Q]
[/F] [/L] [/G] [/H] [/R] [/T]
[/U] [/K] [/N] [/O] [/X] [/Y]
[/-Y] [/Z]
[/EXCLUDE:file1[+file2]…]

As you can see the utility has many options or switches if you like and each of them has certain use to modify what you are trying to accomplish with the command.

My personal use is usually with these switches

XCOPY “C:Documents and Settings%USER%My Documents” “\SERVERSHARE%USER%” /S/Y/D/E

/S Copies directories and subdirectories except empty ones
/Y Suppresses prompting to confirm you want to overwrite an existing destination file
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
As you can see this utility is possible to use in simple batch/script to automate your backup:

:XCOPY path (including the EXE)
SET XCOPY=C:WINDOWSSystem32XCOPY.exe

: XCOPY Source
SET From= “C:Documents and Settings%USER%My Documents”

: XCopy destination
SET To= “\SERVERSHARE%USER%BACKUP”

: EXECUTE THE COMMAND
%XCOPY% %From% %To% /S/Y/D/E

echo BACKUP HAS COMPLETED on %DATE% at %TIME% >> C:BACKUP.LOG
PAUSE

This way every time the files are copied over you will have a simple log when you have completed the task for your reference.

More on XCOPY and switches here

Leave a Reply