Delold source code
From
Nick Andre@618:500/24 to
All on Wednesday, July 26, 2023 17:43:21
Delold is a Freepascal program which deletes all but the X oldest file.
In heavy use here for Fido ZC1 stuff... enjoy.
Should be able to recompile for non-Windows and yes I'm sure theres plenty of room for improvement... This was written in one sitting after a few beers.
program delold;
uses dos;
var dirinfo : SearchRec;
count,newest : longint;
procedure Eraseit;
var f : file;
begin
writeln('Erasing '+dirinfo.name);assign(f,dirinfo.name);erase(f);
end;
begin
count:=0;
writeln('Delold 1.0/Win32 Copyright (c) by Nick J. Andre, Ltd.');
writeln;
if paramstr(1)>'' then
begin
findfirst(paramstr(1),archive,dirinfo);
if DOSerror=0 then begin count:=count+1;newest:=dirinfo.Time;end;
while (DOSerror=0) do
begin
findnext(dirinfo);
count:=count+1;
if dirinfo.Time>newest then newest:=dirinfo.Time;
end;
findclose(dirinfo);
if count>1 then
begin
findfirst(paramstr(1),archive,dirinfo);
repeat
if (DOSerror=0) and (dirinfo.Time<newest) then eraseit;
findnext(dirinfo);
until (DOSerror<>0);
findclose(dirinfo);
end;
end
else
begin
writeln('Usage: DELOLD [filemask]');writeln;
writeln('DELOLD delete the oldest occurances of the mask specified.');
end;
end.
Nick
--- Renegade vY2Ka2
* Origin: Joey, do you like movies about gladiators? (618:500/24)