Computing.Net > Forums > Disk Operating System > daily backup bat file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

daily backup bat file

Reply to Message Icon

Name: EarlGB
Date: September 19, 2005 at 20:35:27 Pacific
OS: ms-dos 6.22
CPU/Ram: PIII/512
Comment:

Would like to backup(xcopy) files to a different directory for each day of the week. Batch file needs to determine day(Sunday-Saturday)automatically, and then copy data files from the application working directory to the appropriate day's backup directory.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: September 19, 2005 at 22:46:09 Pacific
Reply:

The first hump to get over is getting the DAY into a variable for use by the backup bat.

This will get DAY, DATE and TIME into varibles.

:: DtimeDOS.bat
@echo off

echo.|date>datevar.bat
echo.|time>timevar.bat

echo set DATEvar=%%4>current.ba
call datevar

echo set DAYvar=%%3>current.ba
call datevar

echo set TIMEvar=%%3>current.ba
call timevar
:: done

Note that it may need to be tailored becase the output of the DATE & TIME will vary according to version, language, codepage etc.

Once you get that hammered out:

cd c:\appdata
xcopy . c:\DAYvar\


If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: EarlGB
Date: September 20, 2005 at 17:56:38 Pacific
Reply:

M2,

Many thanks for the help. Looks like that will get the date up in a numerical format ok. Any ideas on how to translate that to day of the week, ie; Sunday, Monday, etc. I want to have seven backup directories so I can have a rolling week of backups?

EGB


0

Response Number 3
Name: jboy
Date: September 20, 2005 at 18:50:54 Pacific
Reply:

I saw this site the other day - he uses a program called XSET to simplify the process - seems to be what you're seeking.

If the xset link isn't working, try FileLibrary

Do Not Click


0

Response Number 4
Name: dtech10
Date: September 21, 2005 at 13:59:05 Pacific
Reply:

Hi
Put the Weekday.com code into a text file.
Put a blank line after the last Q.
Save it as Weekday.scr then enter this
on the command line.
debug < Weekday.scr
this creates Weekday.com

Create the second batch file and modify
the "echo it's" to the code required for
the day of the week.
---------------------------
N WEEKDAY.COM
A 100
MOV AH,2A
INT 21
MOV AH,4C
INT 21

R CX
8
W
Q

--------------------------
@echo off
weekday.com
if errorlevel 0 if not errorlevel 1 goto Sunday
if errorlevel 1 if not errorlevel 2 goto Monday
if errorlevel 2 if not errorlevel 3 goto Tuesday
if errorlevel 3 if not errorlevel 4 goto Wednesday
if errorlevel 4 if not errorlevel 5 goto Thursday
if errorlevel 5 if not errorlevel 6 goto Friday
if errorlevel 6 goto Saturday

:Sunday
echo It's Sunday
goto Done
:Monday
echo It's Monday
goto Done
:Tuesday
echo It's Tuesday
goto Done
:Wednesday
echo It's Wednesday
goto Done
:Thursday
echo It's Thursday
goto Done
:Friday
echo It's Friday
goto Done
:Saturday
echo It's Saturday
:Done


0

Response Number 5
Name: EarlGB
Date: September 24, 2005 at 19:09:23 Pacific
Reply:

Wow!!!

You guys are really great.

DOS still lives.

Thanks again.

EGB


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: September 24, 2005 at 21:11:47 Pacific
Reply:

As per #1:

"Note that it may need to be tailored becase the output of the DATE & TIME will vary according to version, language, codepage etc."


If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: daily backup bat file

Backup bat file www.computing.net/answers/dos/backup-bat-file/3828.html

Reg backup bat file www.computing.net/answers/dos/reg-backup-bat-file/8597.html

Trying to set up a bat file to ftp down daily logs. www.computing.net/answers/dos/trying-to-set-up-a-bat-file-to-ftp-down-daily-logs/3131.html