Hi all guy´s. I have a program for packet radio, I´m ham radio. This prg, the TSTHost 1.43c for DOS makes file .log and it gets very big. I want to auto-delete the file once a mouth, but how this machine isn´t powered every days, I need to make "a window" of time for the file being deleted, example, from day 25 to 30 of the month. Is it possible to in a batch file, and call it from autoexec.bat? Best regards.
If there is a possibility of several things going wrong, the one that will cause the most damage will be the one to go wrong.
This is possible. You don't have to call it from autoexec.bat though. You could just put it in the start up folder. So am I understanding you correctly? The machine doesn't get powered on very often. You only want it to clear the .log file if the day of the month is between 25 and 30.
Does MS-Dos 7.10 use a startup folder?
Please come back & tell us if your problem is resolved.
sure you can do that
try this:
setlocal enabledelayedexpansion
set day=%date:~7,2%
if %day% leq 30 if %day% geq 25 del c:\log\lognames.log
endlocalobviously you would substitute your own file for c:\log\lognames.log
you can do more like write the fact that you have cleared the log in a master log file and keep track of housekeeping.. i do this for a defrag command that writes to it's own file so that i can later backtrack if needed
one final note. you should put this in its own .cmd or .bat file in the local path and let something like the DOS command AT.exe or the Windows Scheduled Tasks run this on a Daily event, that way if you dont reboot on a day to day basis, you won't miss the date change.
Oops... Good point Wahine. I missed that critical detail. ha ha
Hey Skorpio07 - the operating system is MS-Dos 7.10 not any breed of Windows.
Please come back & tell us if your problem is resolved.
OK, thanks to all answers. This machine is DOS 7.10 stand alone. No start up folder. And, in true, I use that PC only weekends. So, once a month want to delete this log file. I need to talk a little about the prg TSTHost. Once an hour aproximatelly, this PC calls via packet radio (Like a Internet, but only for ham´s and only text files, and very primitive at 1200 baud in VHF band). Also, the BBS sometimes call to me, and other colleagues too. This prg creates a .log file in where are registered all communications, date, time, the station being connected, etc. that in few time gets very big size. And, also it creates a list (Unproto lists) of the msg´s held at the BBS (but NOT the msg itself). About 20,000 char lines, and the prg doesn´t delete automatically it, it appends at the end of the file the newer lists. In a couple of weeks, it is about 100KB or more. Too much long. So I want to delete both automatically once monthly. Best regards.
If there is a possibility of several things going wrong, the one that will cause the most damage will be the one to go wrong.
does my routine not work (excluding the AT.exe or windows task scheduler)?? if you need to check every hour, just add a loop outside of my routine and have it wait 60 minutes between checking.
was there more that you needed?
Thanks to Skorpio07. I copied to a text file, so this weekend I´ll try it. Very thanks.
If there is a possibility of several things going wrong, the one that will cause the most damage will be the one to go wrong.
| « Choice command half secon... | need to update wins addre... » |