Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Delete log files older than 20 Days 8 years 5 months ago #4640

Hello

I have a requirement to delete data transformation logs older than 20 days old.
Can I do this with Visual Importer ETL

Emiliano

Please Log in or Create an account to join the conversation.

Re: Delete log files older than 20 Days 8 years 5 months ago #4641

  • admin
  • admin's Avatar
  • Offline
  • Moderator
  • Moderator
  • Deeds not Words
  • Posts: 7853
  • Karma: 33
  • Thank you received: 473
Hello

Something like this should do

var i: integer;
Rec : TSearchRec;
Attr : integer;
SearchDirectory,Mask : string;
begin
SearchDirectory:='c:\';
Mask:='*.csv';
Attr := faReadOnly+faHidden+faArchive+faAnyFile;
if FindFirst(SearchDirectory+Mask,Attr,Rec) = 0 then
try
repeat
if ((Rec.Name='..') or (Rec.Name='.'))=false then
begin
if FormatDateTime('YYYY-MM-DD',FileDateToDateTime(FileAge(SearchDirectory+Rec.Name)))<FormatDateTime('YYYY-MM-DD',now-30) then
DeleteFile(SearchDirectory+Rec.Name);
end;
until FindNext(Rec) <> 0;
finally
FindClose(Rec);
end;
result:=true;
end;

George
Mike

Please Log in or Create an account to join the conversation.

Re: Delete log files older than 20 Days 8 years 5 months ago #4707

What actually happens if you won't delete your logs older than 20 days?
Went down deep!!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1

We have 105 guests and one member online