Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   "File not found" Meldung nicht anzeigen lassen. (https://www.delphipraxis.net/163156-file-not-found-meldung-nicht-anzeigen-lassen.html)

Union 17. Sep 2011 21:02

AW: "File not found" Meldung nicht anzeigen lassen.
 
Hier mal ein Beispiel:
Delphi-Quellcode:
//------------------------------------------------------------------------------
procedure TransferFromFtp(const PathName, WildCard: string);
//------------------------------------------------------------------------------
// Datei per FTP vom Server übertragen
//------------------------------------------------------------------------------
var
   FtpClient : TIdFTP;
   FileList : TStringList;
   LocalFile : string;
   i : integer;
begin
   FtpClient := TIdFTP.Create(nil);
   FileList := TStringList.Create;
   try
      FtpClient.Host    := Config.Server;
      FtpClient.Username := Config.User;
      FtpClient.Password := Config.Pass;
      try
         Logg('Connecting to %s', [Config.Server]);
         FtpClient.Connect();
         try
            FtpClient.List(FileList, PathName+WildCard);
            FileList.Clear;
            with FtpClient.DirectoryListing do
               for i := 0 to Count -1 do
               begin
                  LocalFile := ExtractFileName(StringReplace(Items[i].FileName, '/', '\', [rfReplaceAll]));
                  FtpClient.Get(Config.InPath+LocalFile, IncludeTrailingPathDelimiter(Config.ImportDir)+LocalFile);
                  // Nach dem Abholen löschen
                  FtpClient.Delete(Config.InPath+LocalFile);
                  Logg('Transfered %s', [IncludeTrailingPathDelimiter(Config.ImportDir)+LocalFile]);
               end;
         except
            on e : Exception do Logg('FTP transfer error: %s', [e.Message]);
         end;
      except
         on e : Exception do Logg('FTP connect error: %s', [e.Message]);
      end;
      Logg('Disconnecting from %s', [Config.Server]);
      FtpClient.Disconnect;
   finally
      FtpClient.Free;
      FileList.Free;
   end;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:11 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz