Laden...

FTP Client

Erstellt von mosspower vor 15 Jahren Letzter Beitrag vor 15 Jahren 3.674 Views
mosspower Themenstarter:in
456 Beiträge seit 2007
vor 15 Jahren
FTP Client

Hallo "Kollegen",

Hintergrund für die Erstellung des FTP Clients war dieser Thread.

Mit diesem Client bleibt die Connection offen. Ich habe alle gängigen FTP-Befehle implementiert. Uploads und Downloads können auch mittels einer Regular Expression durchgeführt werden. Desweiteren wird das Up- und Downloaden auch asynchron unterstützt (wichtig, um z.B. bei einer GUI-Anwendung den Status anzeigen zu können). Asynchron bedeutet, dass immer eine Datei nach der anderen (hier synchron) asynchron abgefragt werden kann. Das bedeutet, dass bei einem Pattern, das z.B. 20 Files matched alle 20 nacheinander in einem Thread abgearbeitet werden, aber immer für die aktuelle Datei kann der Status abgeholt werden und die Anwendung wartet nicht auf das Ende, bis für alle 20 Dateien die Arbeiten abgeschlossen wurden, sondern läuft weiter. Wichtig ist, dass im "Async-Modus" keine folgenden Befehle abgefeuert werden, denn dann kracht es, man muss warten, bis der Async-Modus wieder verlassen wurde, bzw. fertig ist. Näheres ist im Beispiel-Quellcode unten beschrieben.

Bei Kritik, Wünschen und Anregungen bitte an mich wenden. Weiterentwicklung ist gewünscht. Ferner will ich unbedingt "das Teil" noch SFTP-fähig machen. Vielleicht bekomme ich von euch Unterstützung bzw. helfende Hinweise dafür. So, ich poste jetzt einfach mal mein Test-Projekt mit den Beschreibungen (auf Englisch) ...

mosspower Themenstarter:in
456 Beiträge seit 2007
vor 15 Jahren

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ftp;
using System.Text.RegularExpressions;
using System.Threading;

namespace Test.Ftp {
  public class FtpClientTester {
    static FtpClient ftpClient = null;
    static bool debugMode = true;
    static int transferPercentage = 0;

    static void Main(string[] args) {
      try {
        ftpClient = new FtpClient("192.168.0.198", @"ftppower", "*****", debugMode);
        ftpClient.Login();

        // **********************
        // Supported FTP commands
        // **********************

        // ftpClient.ChangeDirectory("fo");
        // ftpClient.RemoveDirectory("foo");
        // ftpClient.MakeDirectory("foo");
        // ftpClient.RemoveFile("blub.txt");
        // ftpClient.RemoveFiles("pattern");
        // ftpClient.Rename("from", "to");
        // ftpClient.DownloadFile("text.txt");
        // ftpClient.DownloadFileAsync("text.txt");
        // ftpClient.DownloadFiles("txt$");
        // ftpClient.DownloadFilesAsync("txt$");
        // ftpClient.UploadFile("text.txt");
        // ftpClient.UploadFileAsync("text.txt");
        // ftpClient.UploadFiles("txt$");
        // ftpClient.UploadFilesAsync("txt$");
        // ftpClient.GetWorkingDirectory());
        
        // *************
        // Sync examples
        // *************

        // Uploads all text files from the application startup path
        // to the working directory on the FTP server and deletes
        // all matching local files after downloading each file in sync mode
        IList<FtpTransferInfo> ftpTransferInfos = 
          ftpClient.UploadFiles("txt$", RegexOptions.IgnoreCase, true);

        // Downloads all text files in the working directory 
        // on the FTP server and deletes all matching files 
        // on the FTP server after uploading each file in sync mode
        ftpTransferInfos = 
          ftpClient.DownloadFiles("txt$", RegexOptions.IgnoreCase, true);

        // FtpTransferInfo ftpTransferInfo;
        // FtpTransferInfo with transfer (upload or download) infos

        // ftpTransferInfo.BytesSize 
        // => The size of a file 

        // ftpTransferInfo.StartAt
        // => The time when the transfer started

        // ftpTransferInfo.EndAt 
        // => The time when the transfer ended 

        // ftpTransferInfo.FileDeleted 
        // => Whether the file has been deleted after transfer

        // ftpTransferInfo.FtpException 
        // => Exception while transfer, this is important in async mode

        // ftpTransferInfo.LastModification 
        // => The last modification of the directory or file

        // ftpTransferInfo.Name 
        // => The name of the file

        // ftpTransferInfo.SourceDirectory 
        // => The source directory, download = working directory on FTP server, 
        // => upload = source directory on client

        // ftpTransferInfo.SuccessBytes
        // => The amount of bytes successfully transferred

        // ftpTransferInfo.TargetDirectory
        // => The target directory, download = path on client, upload = working
        // => directory on FTP server

        // ftpTransferInfo.TransferType
        // => Upload or download

        // ftpTransferInfo.GetSuccessPercentage() 
        // => The percentage of transferred bytes

        // ftpTransferInfo.GetTransferTime()
        // => Timespan from startup to end of the transfer

        // ftpTransferInfo.IsComplete()
        // => Whether the transfer has completed

        // **************
        // Async examples
        // **************

        // Uploads all text files from the FTP server in the working directory
        // to the application startup path in async mode
        ftpTransferInfos = ftpClient.UploadFilesAsync("txt$", RegexOptions.IgnoreCase);

        // Assign event handlers for all files
        foreach(FtpTransferInfo ftpTransferInfo in ftpTransferInfos) {
          // Dwonloaded file size has changed
          ftpTransferInfo.StatusExchange += 
            new FtpTransferInfo.StatusExchangeEventHandler(OnStatusExchange);
          // Error happened
          ftpTransferInfo.TransferError += 
            new FtpTransferInfo.TransferErrorEventHandler(OnTransferError);
          // Transfer, here download, has been completed
          ftpTransferInfo.TransferComplete += 
            new FtpTransferInfo.TransferCompleteEventHandler(OnTransferComplete);
        }

        // !!! Do not fire FTP commands in async mode, this will cause an error, !!!
        // !!! just wait till async mode is exiting                              !!!
        // !!! One can handle that with the AsyncComplete event handler or       !!!
        // !!! the ugly way with looping and time outs                           !!!

        // => The ugly way
        //while(ftpClient.IsAsyncMode()) {
        //  Thread.Sleep(1000);
        //}
        //
        // Here you can fire FTP commands again

        // => The tidy way
        // Download for all files have been completed, exit async mode
        ftpClient.AsyncComplete += new FtpClient.AsyncCompleteEventHandler(OnAsyncComplete);
      }
      catch(Exception ex) {
        Console.WriteLine("Exception ['{0}'] - '{1}'",
          new Object[] { ex.GetType().FullName, ex.Message });
      }

      Console.ReadLine();
    }

    static void OnAsyncComplete() {
      ftpClient.ListWorkingDirectory();
      ftpClient.Logout();
    }

    static void OnTransferComplete(FtpTransferInfo ftpTransferInfo) {
      Console.WriteLine(String.Format("Download completed for file '{0}'", ftpTransferInfo.Name));
      Console.WriteLine(String.Format("Download for file '{0}' took '{1}' seconds",
        ftpTransferInfo.Name, ftpTransferInfo.GetTransferTime().TotalSeconds));
      transferPercentage = 0;
    }

    static void OnTransferError(FtpTransferInfo ftpTransferInfo) {
      Console.WriteLine(String.Format("Download error happened for file '{0}' with message '{1}'",
        ftpTransferInfo.Name, ftpTransferInfo.FtpException.Message));
    }

    static void OnStatusExchange(FtpTransferInfo ftpTransferInfo) {
      if((int)ftpTransferInfo.GetSuccessPercentage() != transferPercentage) {
        Console.WriteLine("[{0}] -> Download progress '{1}' % for file '{2}'", 
          DateTime.Now.ToString("HH:mm:ss.fff"), (int)ftpTransferInfo.GetSuccessPercentage(), ftpTransferInfo.Name);
        transferPercentage = (int)ftpTransferInfo.GetSuccessPercentage();
      }
    }
  }
}

mosspower Themenstarter:in
456 Beiträge seit 2007
vor 15 Jahren

Die Ausgabe für obigen Test, im Debugmodus, mit zwei Textdateien im aktuellen Verzeichnis, sieht dann so aus:


Sending command 'USER ftppower'
331 Password required for ftppower.
Sending command '*******'
230 User ftppower logged in.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,190).
Sending command 'STOR Text1.txt.tmp'
125 Data connection already open; Transfer starting.
Sending command 'PWD'
226 Transfer complete.
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,191).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:56AM                 8128 Text1.txt
03-10-09  02:56AM                 8128 Text1.txt.tmp
03-10-09  02:56AM               780290 Text2.txt
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'PWD'
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,192).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:56AM                 8128 Text1.txt
03-10-09  02:56AM                 8128 Text1.txt.tmp
03-10-09  02:56AM               780290 Text2.txt
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'DELE Text1.txt'
250 DELE command successful.
Sending command 'RNFR Text1.txt.tmp'
350 File exists, ready for destination name
Sending command 'RNTO Text1.txt'
250 RNTO command successful.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,193).
Sending command 'STOR Text2.txt.tmp'
125 Data connection already open; Transfer starting.
Sending command 'PWD'
226 Transfer complete.
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,194).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:56AM                 8128 Text1.txt
03-10-09  02:56AM               780290 Text2.txt
03-10-09  02:57AM               780290 Text2.txt.tmp
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'PWD'
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,195).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:56AM                 8128 Text1.txt
03-10-09  02:56AM               780290 Text2.txt
03-10-09  02:57AM               780290 Text2.txt.tmp
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'DELE Text2.txt'
250 DELE command successful.
Sending command 'RNFR Text2.txt.tmp'
350 File exists, ready for destination name
Sending command 'RNTO Text2.txt'
250 RNTO command successful.
Sending command 'PWD'
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,196).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:56AM                 8128 Text1.txt
03-10-09  02:57AM               780290 Text2.txt
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,197).
Sending command 'RETR Text1.txt'
125 Data connection already open; Transfer starting.
Sending command 'PWD'
226 Transfer complete.
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,198).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:56AM                 8128 Text1.txt
03-10-09  02:57AM               780290 Text2.txt
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'DELE Text1.txt'
250 DELE command successful.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,199).
Sending command 'RETR Text2.txt'
125 Data connection already open; Transfer starting.
Sending command 'PWD'
226 Transfer complete.
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,200).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:57AM               780290 Text2.txt
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'DELE Text2.txt'
250 DELE command successful.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,201).
Sending command 'STOR Text1.txt.tmp'
125 Data connection already open; Transfer starting.
[02:57:08.656] -> Download progress '12' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '25' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '37' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '50' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '62' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '75' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '88' % for file 'Text1.txt'
[02:57:08.656] -> Download progress '100' % for file 'Text1.txt'
Download completed for file 'Text1.txt'
Download for file 'Text1.txt' took '0' seconds
Sending command 'PWD'
226 Transfer complete.
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,202).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:57AM                 8128 Text1.txt.tmp
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'PWD'
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,203).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:57AM                 8128 Text1.txt.tmp
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'RNFR Text1.txt.tmp'
350 File exists, ready for destination name
Sending command 'RNTO Text1.txt'
250 RNTO command successful.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,204).
Sending command 'STOR Text2.txt.tmp'
125 Data connection already open; Transfer starting.
[02:57:10.250] -> Download progress '1' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '2' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '3' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '4' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '5' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '6' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '7' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '8' % for file 'Text2.txt'
[02:57:10.250] -> Download progress '9' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '10' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '11' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '12' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '13' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '14' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '15' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '16' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '17' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '18' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '19' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '20' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '21' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '22' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '23' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '24' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '25' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '26' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '27' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '28' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '29' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '30' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '31' % for file 'Text2.txt'
[02:57:10.265] -> Download progress '32' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '33' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '34' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '35' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '36' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '37' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '38' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '39' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '40' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '41' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '42' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '43' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '44' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '45' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '46' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '47' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '48' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '49' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '50' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '51' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '52' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '53' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '54' % for file 'Text2.txt'
[02:57:10.281] -> Download progress '55' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '56' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '57' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '58' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '59' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '60' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '61' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '62' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '63' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '64' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '65' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '66' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '67' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '68' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '69' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '70' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '71' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '72' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '73' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '74' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '75' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '76' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '77' % for file 'Text2.txt'
[02:57:10.296] -> Download progress '78' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '79' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '80' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '81' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '82' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '83' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '84' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '85' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '86' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '87' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '88' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '89' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '90' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '91' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '92' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '93' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '94' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '95' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '96' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '97' % for file 'Text2.txt'
[02:57:10.312] -> Download progress '98' % for file 'Text2.txt'
[02:57:10.328] -> Download progress '99' % for file 'Text2.txt'
Download completed for file 'Text2.txt'
Download for file 'Text2.txt' took '0,078125' seconds
Sending command 'PWD'
226 Transfer complete.
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,205).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:57AM                 8128 Text1.txt
03-10-09  02:57AM               780290 Text2.txt.tmp
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'PWD'
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,206).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:57AM                 8128 Text1.txt
03-10-09  02:57AM               780290 Text2.txt.tmp
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'RNFR Text2.txt.tmp'
350 File exists, ready for destination name
Sending command 'RNTO Text2.txt'
250 RNTO command successful.
Sending command 'PWD'
257 "/" is current directory.
Sending command 'TYPE I'
200 Type set to I.
Sending command 'PASV'
227 Entering Passive Mode (192,168,0,198,19,207).
Sending command 'LIST'
125 Data connection already open; Transfer starting.
226 Transfer complete.
03-08-09  07:04PM       <DIR>          Kopie (2) von Neuer Ordner
03-08-09  07:04PM       <DIR>          Kopie von Neuer Ordner
03-08-09  05:37PM       <DIR>          Neuer Ordner
03-10-09  02:57AM                 8128 Text1.txt
03-10-09  02:57AM               780290 Text2.txt
03-09-09  02:05AM       <DIR>          Tmp
03-10-09  01:07AM               326875 XXXDownload1.wmv
03-10-09  01:07AM            108331316 XXXDownload2.wmv
03-10-09  01:07AM            108331316 YYYDownload2.wmv
Sending command 'QUIT'
0 Quit on FTP server

mosspower Themenstarter:in
456 Beiträge seit 2007
vor 15 Jahren

Alles wurde mit .NET 3.5 entwickelt und compiliert (läuft aber auch mit 2.0).

Hier noch der Quellcode ...