- Posts: 11
- Thank you received: 0
ETL file operation options suggestions
11 years 3 months ago #5266
by Oscar
ETL file operation options suggestions was created by Oscar
Hello
I’ve been working on setting up some packages and was wanting to either delete or move files dependent upon their age to archive directories or just deleting them. I found the following within your forum regarding deleting files > 30 days old.
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;
Pretty complicated script for novices like me. Then having to tweak it for copying or moving.
It occurred to me that another nice enhancement to your product would be to add the capability to your “File Operations” within Packages to copy, move or delete files greater than a certain number of days, months or years.
Oscar
I’ve been working on setting up some packages and was wanting to either delete or move files dependent upon their age to archive directories or just deleting them. I found the following within your forum regarding deleting files > 30 days old.
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;
Pretty complicated script for novices like me. Then having to tweak it for copying or moving.
It occurred to me that another nice enhancement to your product would be to add the capability to your “File Operations” within Packages to copy, move or delete files greater than a certain number of days, months or years.
Oscar
Please Log in or Create an account to join the conversation.
11 years 3 months ago #5267
by admin
Mike
ETL Architect
Replied by admin on topic Re: ETL file operation options suggestions
Oscar
Thanks for the suggestions
We have implemented it for File/ZIP and check file Operations
See attached picture
Mike
Thanks for the suggestions
We have implemented it for File/ZIP and check file Operations
See attached picture
Mike
Mike
ETL Architect
Attachments:
Please Log in or Create an account to join the conversation.
11 years 3 months ago #5270
by Oscar
Replied by Oscar on topic Re: ETL file operation options suggestions
Mike
Thanks so much for incorporating the suggestions into your latest version!
Oscar
Thanks so much for incorporating the suggestions into your latest version!
Oscar
Please Log in or Create an account to join the conversation.
11 years 3 months ago #5271
by admin
Mike
ETL Architect
Replied by admin on topic Re: ETL file operation options suggestions
If you want to work with SalesForce/BrightPearl/JDBC/Google spreadsheets
You would need to patch the repository
Mike
You would need to patch the repository
Mike
Mike
ETL Architect
Please Log in or Create an account to join the conversation.