home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
bbs_mail
/
delbsy.arj
/
DELBSY.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1992-05-09
|
1KB
|
48 lines
Program DelBusy;
Uses Dos,STRNTTT5;
Var
Parm1 : String;
Parm2 : string;
DT : DateTime;
LDT : LongInt;
SR : SearchRec;
TestVar : Longint;
BsyFile : File;
Parm2W,
IOR,
sec100,
DOW : Word;
Begin
Writeln ('DelBusy By Joe Jared of 1:125/1212@Fidonet');
If ParamCount <2 then begin
Writeln ('Purpose: Deletes busy files older than x minutes');
Writeln ('Example: Delbusy f:\binkley\flags 7200');
Writeln ('To kill all busy files older than 2 hours (7200 seconds)');
End;
GetDate(DT.Year, DT.Month, DT.Day, DOW);
GetTime(DT.Hour,DT.Min, DT.Sec,Sec100);
Parm2W := Str_to_Int(Parm2) ;
PackTime(DT,LDT);
Parm1 := ParamStr(1)+'\*.bsy';
FindFirst(Parm1,Anyfile,SR);
IOR := DosError;
While IOR = 0 Do begin
TestVar := LDT - SR.Time;
If TestVar > Parm2W Then Begin
Writeln (Sr.Name, ' is ', TestVar, ' seconds old.');
Writeln ('Deleting');
Assign (BsyFile,Parm1+'\'+SR.Name);
Erase (BsyFile);
End
Else Writeln (SR.Name, ' is ' ,TestVar,' seconds old.');
Findnext(SR);
IOR := DosError;
End;
End.