Hi,
Any hint how to use FindFirst in script? I have the following script code and I get Acess Violation Exception when I try to read "SR.Time".
Using "TSearRec" I get the same Result.
Thansk in Advance.
procedure LimpiaLogDir;
var
SR : TSearchRecWrapper;
DifDias : integer;
fileName : string;
CodeSiteLogDir : string;
begin
CodeSiteLogDir := 'D:\ISAT\LOG\';
SR := nil
if FindFirst(IncludeTrailingPathDelimiter(CodeSiteLogDir) + '*.csl', faAnyFile, SR) = 0 then
begin
repeat
DifDias := Trunc(GetToday) - Trunc(SR.Time);
if DifDias >= 15 then
begin
fileName := IncludeTrailingPathDelimiter(CodeSiteLogDir) + SR.Name;
DEBUG_STRING('>>Elimina ' + fileName);
DeleteFile(fileName);
end;
until FindNext(SR) <> 0;
FindClose(SR);
end;
end;