+1 vote
by
retagged by

1 Answer

0 votes

Why would you want to do that?

DIR is Windows command prompt command. You should use appropriate FTP command:

using (Ftp client = new Ftp())
{
    client.Connect("ftp.example.org");
    client.Login("user", "password");

    client.ChangeFolder("reports");

    List<FtpItem> items = client.GetList();

    foreach (FtpItem item in items)
    {
        Console.WriteLine("Name:        {0}", item.Name);
        Console.WriteLine("Size:        {0}", item.Size);
        Console.WriteLine("Modify date: {0}", item.ModifyDate);

        Console.WriteLine("Is folder:   {0}", item.IsFolder);
        Console.WriteLine("Is file:     {0}", item.IsFile);
        Console.WriteLine("Is symlink:  {0}", item.IsSymlink);

        Console.WriteLine();
    }

    client.Close();
}

Appropriate FTP command is going to be issued: LIST, MLST and response parsed.

by (297k points)
Questoin about DIR / LIST / GetList() method.
...