Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP mget in Indy TIdFTP?

Status
Not open for further replies.

CHeighlund

Programmer
Jun 11, 2007
163
US
Does anyone know whether or not the Indy component TIdFTP supports the mget ftp command? The normal 'get' method doesn't seem to want to work with wildcards, and I need the wildcard ability; the files I'm supposed to be retrieving will have a timestamp as part of their names, and I'm not going to know in advance what that timestamp is.

Again, does anyone know whether or not the TIdFTP component can support the mget ftp command? Or, alternately, does anyone know of another FTP component that supports this method?

Thank you for your consideration.
 
I ran into the same problem in developing my SFTP app. I couldn't find an mGet solution in the Indy 10 files either, and if there is it may take me years to find it. This code should get you on track for your own mGet:

Code:
[b]vars:[/b]
fList : tStringList;
exList: TStringList;
gStr : string; [b]//this could be *.zip, *.?xt, etc.[/b]
DirList: TIdFTPListItems;
=========================

      fList := tStringList.create;
      FTP.List(fList, gStr, False);
      DirList := FTP.DirectoryListing;
      for h:=0 to fList.Count-1 do begin
          if (fList.strings[h]<>'.') and (fList.strings[h]<>'..') then begin
              exList.add(fList.strings[h]); // [b]Main stringList you want to work with[/b]
                                            // [b]Issue Get for each file in a FOR loop with exList[/b]
          end;
      end;
      fList.free;

Dirty, yes very dirty, but it works very well.


Getting answers before I'm asked.
Providing answers if I can.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top