Monday, November 30, 2009

Using xcopy to backup your important files.

If you have an external hard drive and want to use it as a backup for your important files at home or office, here's a simple usefull Microsoft DOS xcopy command and it's available in the below Microsoft operating systems:

MS-DOS 3.3x and above
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7

Copy below command into a text file and rename txt to bat and change "test" to your folder name. You can also duplicate xcopy command if you have several folders.
------
@echo off
xcopy z:\test\*.* l:\test\ /e /h /v /d /y /c
------

EXAMPLE1:
--------------





@echo off
xcopy z:\test\*.* l:\test\ /e /h /v /d /y /c >z:\report test.txt <---Add ">z:\test.txt" at the end to make a log file.


EXAMPLE2:
--------------
@echo off
Mkdir "%DATE%"     <---Make a new directory by current date
move report.txt "%DATE%"   <---Move txt files to new directory
xcopy "L:\Very long folder name\*.*" "D:\Very long folder name\"  <--- add " " when you have long folder name otherwise you'll get error


[SYNTAX]
ECHO [ON | OFF]
ON      : Display each line of the batch on screen (default)
OFF    : Only display the command output on screen message : a string of characters to display

/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.
/V    Verifies each new file.
/C    Continues copying even if errors occur.
/H    Copies hidden and system files also.
/Y    Suppresses prompting to confirm you want to overwrite an existing destination file.

/S Copies directories and subdirectories except empty ones.
http://www.computerhope.com/xcopyhlp.htm (XCOPY SYNTAX)

No comments:

Post a Comment