i found a workaround using idftp capabilities
i needed a way to ftp numerous files for edi.
the filenames aren't standardized, so i came up
with this approach...
basically, i dump the listresult in a memo component
and use the line text in the memo to perform a pseudo mget
in my situation i needed to get several files from one server,
archive them to a different directory on that server, and append all the
files to a single file for a different server.
idftp2 is the host server
idftp1 is the receiving server
hope this helps ...
[code]
procedure TForm1.Button3Click(Sender: TObject);
var
AFiles : TStringList;
stroll : integer;
parse : integer;
chop : integer;
trucount : integer;
edifile : string;
stamped : string;
stampfile : string;
begin
{perform the inbound inquery}
with idftp2 do begin
sql_memo.Clear;
Afiles := TStringList.Create;
disconnect;
connect(true);
changedir('/elvis/sandwich/company');
List(AFiles,'945.*',true);
sql_memo.Lines.Addstrings(listresult);
Disconnect;
end;
trucount:= 0;
with sql_memo do begin
for stroll:=0 to lines.Count-1 do begin
if pos('945.',lines[stroll]) > 0 then begin
trucount:=trucount+1;
end;
end;
end;
if trucount > 0 then begin
{secure and trim the filenames}
with sql_memo do begin
for stroll:=0 to lines.Count-1 do begin
if pos('945.',lines[stroll]) > 0 then begin
parse:=pos('945.',lines[stroll]);
chop:=length(lines[stroll]);
lines[stroll]:=copy(lines[stroll],parse,chop-parse+1);
end;
end;
end;
{ftp 'get' the filenames}
with sql_memo do begin
idftp2.connect(true);
idftp2.changedir('/elvis/sandwich/company');
for stroll:=0 to lines.count-1 do begin
edifile:=lines[stroll];
idftp2.Get(edifile,'c:\home\'+edifile);
idftp2.Delete(edifile);
end;
idftp2.disconnect;
end;
{attempt to mirror the the standardized filename 945in.YYMMDDhhnn}
{stamped:=formatdatetime('yymmddhhnnsszzz',now); }
{ftp 'put' to archive the filenames}
with sql_memo do begin
idftp2.connect(true);
idftp2.changedir('/elvis/sandwich/archive/company');
for stroll:=0 to lines.count-1 do begin
stamped:=formatdatetime('yymmddhhnnsszzz',now);
edifile:=lines[stroll];
stampfile:='945in.'+stamped;
idftp2.put('c:\home\'+edifile,stampfile,false);
end;
idftp2.disconnect;
end;
{now reverse this but append the files into 945xxx.txt}
with sql_memo do begin
idftp1.connect(true);
idftp1.changedir('/company/ediin');
for stroll:=0 to lines.count-1 do begin
edifile:=lines[stroll];
idftp1.put('c:\home\'+edifile,'945xxx.txt',true);
end;
edifile:='945xxx.txt';
idftp1.Get(edifile,'c:\home\'+edifile);
idftp1.disconnect;
end;
end; {end of trucount condition}
end;