XCOPY Method


Following file will copy all the data from the source folder to target folder using windows builtin copy tool XCOPY.

1
2
3
4
5
6
7
8
9
@echo off
echo * * *  >> C:\backup-log.txt
echo Mail Backup Starts at %date% - %time%  >> C:\backup-log.txt
C:\windows\system32\xcopy.exe B:\source-folder\*.*  T:\targetfolder /S /D /C /Y
echo Mail Backup Ends at %date% - %time%  >> C:\backup-log.txt
echo * * * >> C:\backup-log.txt

The above commands description is as follows.

/S = Copies directories and sub-directories except empty ones.
/D =  If no date is given, copies only those files whose  source time is newer than the destination time.
/C = Continues copying even if errors occur.
/Y  = Overwrite existing files if any without prompting, its necessary when you are running xcopy via batch / script file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: