Question Locked

Batch file for backup

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Need help in writing a batch file to backup data on microsoft windows server 2003 r2. However i already have written a simple batch file using the xcopy command. Unfortunately it is working fine on my local system, but not on the server. kindly help!!!

8 replies

by Former member

For backups I tend to look for something a little extra. You might not want a large backup solution.

For simple tasks I am a fan of syncback

http://www.2brightsparks.com/ - freeware and commercial versions

by Member 31348703

Thanks for your response. As em very new to programming em yet to learn the use of those commands. However i have written a simple batch file using xcopy which is working fine. Below is the script,

@echo off
REM copy documents
xcopy "E:\Ram\Queries\D1 DUMPING QUERIES" "E:\Ram\" /c /s /r /d /y /i > E:\Ram\xcopy.log

However i now have to modify this script to create a new folder with the system date and time every time this script is run and then backup to that folder.

Would be great if you ppl can help me out with this!!!!

by Member 31348703

Thank you very much!!! I modified the script as follows, but didn't work,

set folder=%date:~10,4%%date:~7,2%%date:~4,2%
mkdir %folder%
xcopy "D:\Ram\Doc's\files" "D:\%folder%" /c /s /r /d /y /i > "D:\%folder%\xcopy.log"

What i want his batch file to do is create a new folder in D:\ with the system time and date as its name and then copy the contents of D:\Ram\Doc's\files in to it.

Please Advice!!!!!

by Member 31348703

All, I got the script working, but the script creates a folder with only the current date as its name. How do i include current time as well in the name. Below is my script,

Set FDate=%Date:~-10,10%
Set Fdate=%FDate:/=-%
MD D:\%FDate%
xcopy "D:\Ram\Doc's\files" "D:\%FDate%" > "D:\%FDate%\xcopy.log"

Please help me modify the script to meet my needs...

This discussion is closed to new replies.