public static void Main(string[] args) { var server = ConfigurationManager.AppSettings["server"]; var userName = ConfigurationManager.AppSettings["userName"]; var password = ConfigurationManager.AppSettings["password"]; var port = int.Parse(ConfigurationManager.AppSettings["port"]); var engine = StartEngine(); var script = engine.Loader.FromString(SCRIPT); var process = engine.CreateProcess(new MainClass(), script); var conn = FtpConnection.Constructor(ValueFactory.Create(server), ValueFactory.Create(port), ValueFactory.Create(userName), ValueFactory.Create(password), null, ValueFactory.Create(true)) as FtpConnection; conn.SetCurrentDirectory("/123"); Console.WriteLine("PWD: {0}", conn.GetCurrentDirectory()); conn.SetCurrentDirectory("456"); Console.WriteLine("PWD: {0}", conn.GetCurrentDirectory()); conn.Delete(@"../", @"some.zip"); conn.Put(@"D:\temp\some.zip", "some.zip"); ListFiles(conn); conn.Move("some.zip", "../some.zip"); ListFiles(conn); conn.Get(@"../some.zip", @"C:\temp\some.zip"); Console.WriteLine("Done."); }
public static void Main(string[] args) { var engine = StartEngine(); var script = engine.Loader.FromString(SCRIPT); var process = engine.CreateProcess(new MainClass(), script); var conn = FtpConnection.Constructor(ValueFactory.Create("10.2.150.7"), ValueFactory.Create(21), ValueFactory.Create("update"), ValueFactory.Create("")) as FtpConnection; conn.SetCurrentDirectory("Storage1C"); Console.WriteLine("PWD: {0}", conn.GetCurrentDirectory()); conn.SetCurrentDirectory("Obmen"); Console.WriteLine("PWD: {0}", conn.GetCurrentDirectory()); conn.SetCurrentDirectory("/Storage1C/Obmen"); Console.WriteLine("PWD: {0}", conn.GetCurrentDirectory()); var files = conn.FindFiles("", "", true); var first = true; foreach (var el in files) { var file = el as FtpFile; Console.WriteLine("file: {0}, Size={1}, Time={2}", el, file.Size(), file.GetModificationTime()); if (first) { conn.Get(file.FullName, @"C:\temp\some.zip"); conn.Delete(file.FullName); conn.Put(@"C:\temp\some.zip", file.FullName); first = false; } } Console.ReadKey(); }