static void Main(string[] args) { var ftpClient = new Ftp(FtpUri, UserName, UserPass); var list = GetFileNameList(ftpClient, "/files"); if (list.Any()) { Array.ForEach(list, filename => { if (filename == "") return; var remotePath = "/files/" + filename; var localPath = LocalPath + filename; Console.WriteLine(remotePath + "..." + localPath); ftpClient.Download(remotePath, localPath); }); } //var schedule = new Schedule(13, 49); //schedule.ScheduleJob(t => //{ // Console.WriteLine("Trigger"); // //schedule.Timer.Change(10000, 1000); //}); Console.ReadKey(); }
static string[] GetFileNameList(Ftp client,string folder) { if (client == null) throw new NullReferenceException(); var list = client.DirectoryListSimple(folder); return list; }