using System;
using System.Collections.Generic;
using Limilabs.FTP.Client;

namespace ListFilesAndFolders
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (Ftp client = new Ftp())
            {
                client.Connect("ftp.example.org");
                client.Login("username", "password");

                // select the desired folder 
                client.ChangeFolder("path");

                // retrieve and display the list of files and directories 
                List<FtpItem> list = client.GetList();

                foreach (FtpItem item in list)
                {
                    Console.Write(item.ModifyDate.ToString());
                    Console.Write(item.Size.ToString().PadLeft(10, ' '));
                    if (item.IsFolder == true)
                        Console.Write(" [{0}]", item.Name);
                    else
                        Console.Write(" {0}", item.Name);
                    Console.WriteLine();
                }
                client.Close();
            }
            Console.ReadKey();
        }
    } ;
}
