Create a batch file to backup the content

By alok.behria ·
Hi All,

I need to create a batch file , which can copy the contects of one folder to other. for example, i have some folder which also contains other sub folder, now i need to backup all the sub folder of Alok and when I run it second time, then it should only backup the changes files or folders since the last copy.

Hare Krishna

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by XSive In reply to Create a batch file to ba ...

You can do this using a utilty called Robocopy (contender for one of the best utiltity names ever surely!)
It's available with the resource kit, you can use the /MIR option to mirror the contents of the directory initially. Then create another batch file to only copy those files which are changed thereafter.

Collapse -

Try the batch job fiound in the link!

by 123 In reply to Robocopy!
Collapse -


by Toivo Talikka In reply to Create a batch file to ba ...

How about just using XCOPY in a .bat or .cmd file?

The first copy:
cd \backup\servername
xcopy \\servername\folder\*.* /e /q /c

Subsequent copies:
cd \backup\servername
xcopy \\servername\folder\*.* /d /e /q /c /y

You may want to remove everything from d:\backup\servername say once a month before the backup script is run, simply to get rid of obsolete files which have already been deleted from the server.

Collapse -


by mike In reply to XCOPY

this script first creates a backup then only copies increments (changes to the original backup)? Then flush the backup and repeat steps 1 & 2 on a monthly basis?

Collapse -

i want to creat backup of my server via bat file

by atul_malviya07574 In reply to Create a batch file to ba ...

nothing more special want to do this
the begest hant for me to do

Collapse -

This should work for you

by tonymonreal In reply to Create a batch file to ba ...

This Batch should work for what you need.
I use it my self and it works pretty good
All you need to do is Change the Drive and folder name to the ones you need to back up.
It will copy the target folder and any subfolders in it and after the initial backup it will only backup any changes made.

@echo off
:: variables
set backup=xcopy /s /c /d /e /h /i /r /y

echo Backing up My Documents...
%backup% \"My Documents" C:\"Back up"

echo Backup Complete!

Related Discussions

Related Forums