Tech Support > Operating Systems > MS-DOS > Help needed- dos batch programming
Help needed- dos batch programming
Posted by assafm@gmail.com on July 20th, 2006


Hi There,
I am new in this forum, and hope to get some help with my problem.

In the company i work, we backup the server data to few external HD.
Every few days we change the hd and after two weeks, we get back to the
first hd and so on... the problem is that the secretary who responsible
to switch the hd always make mistakes and put the recent one. we want
to add a section to the batch file that check the volume serial number
of the external hd and make sure it is the one for backuping this week.
for example: this week i am using HD #1, and his serial number is
xxxx-xxxx.
if the secretary put a different number, it should write, "HD doesnt
match" or something...

is anyone know how to do this?

Thanks in advance
Assaf

Posted by Todd Vargo on July 21st, 2006



<assafm@gmail.com> wrote in message
news:1153437201.614923.52680@i3g2000cwc.googlegrou ps.com...
alt.msdos.batch.nt is a better place to discuss batch files for Windows XP.

How many drives is a few? For a set of seven backup drives, I would create a
flag file on each HD and simply use an if exist command to make sure the
correct HD is connected. To do this I would create a file named MON.DRV on
Monday's drive, TUE.DRV on Tuesday's drive, and so on. For my system, %date%
returns "Thu 07/20/2006" so the following command can be used. (Modify to
suit your own date format)

@echo off
if not exist d:\%date:~0,3%.drv echo Wrong backup drive!&goto :eof
::Put your backup routine here.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)


Posted by assafm@gmail.com on July 21st, 2006


wow... it is simple..
thank you very very much

THANKS!!! after many hours you help me achive what i was looking for
thanks :-)

Assaf M.


Guy כתב:

Posted by assafm@gmail.com on July 22nd, 2006


Thanks again, It works. :-)

there is another section in the "backup.bat" file i need your help with

for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set var=
%%B.%%A.%%C
md %var%
cd C:\%var%\

those lines create a folder with today date, with a specific format
and then i use xcopy to backup the files to this folder on the external
drive
after X days of backuping, i have X folders on the hd, for example:
20.07.2006
21.07.2006
22.07.2006

i need to add a section that check the hd disk space
if it's less then 1 gb
then it should delete the oldest folder

i will appreciate any help,
thanks very very much
Assaf M.





Guy כתב:

Posted by assafm@gmail.com on July 22nd, 2006


Thanks again, It works. :-)

there is another section in the "backup.bat" file i need your help with



for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set var=
%%B.%%A.%%C
md %var%
cd C:\%var%\


those lines create a folder with today date, with a specific format
and then i use xcopy to backup the files to this folder on the external

drive
after X days of backuping, i have X folders on the hd, for example:
20.07.2006
21.07.2006
22.07.2006


i need to add a section that check the hd disk space
if it's less then 1 gb
then it should delete the oldest folder


i will appreciate any help,
thanks very very much
Assaf M.

Posted by Todd Vargo on July 24th, 2006



<assafm@gmail.com> wrote in message
news:1153580754.428057.175880@75g2000cwc.googlegro ups.com...
Multi-posting is evil!
I'm sorry I provided a solution in the other group now.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)



Similar Posts