public void Test() { using (FTPClient ftpClient = new FTPClient("127.0.0.1")) { ftpClient.Mode = FtpMode.Passive; ftpClient.Connect("127.0.0.1"); ftpClient.Login("admin", "123"); ftpClient.SendCommand("SYST", true); //ftpClient.SendCommand("FEAT",true); //ftpClient.SendCommand("CLNT 1.0.0.0",true); //ftpClient.SendCommand("OPTS UTF8 ON",true); ftpClient.SendCommand("PWD", true); //ftpClient.SetCurrentDirectory("/myphp"); string[] strings = ftpClient.Dir(""); foreach (string s in strings) { ftpClient.GetFile(s, "D:\\" + s); } //ftpClient.SendFile(@"C:\test.zip", "aa.zip", FtpType.Binary); //ftpClient.GetFile("aa.zip", @"D:\test.zip", FtpType.Binary); //ftpClient.MoveFile("aa.zip", "test"); } }
public void FtpTest() { FTPClient ftpClient = new FTPClient("127.0.0.1"); ftpClient.Mode = FtpMode.Passive; ftpClient.Connect(); ftpClient.Login("admin","123"); ftpClient.SendCommand("SYST",true); ftpClient.SendCommand("FEAT",true); ftpClient.SendCommand("CLNT 1.0.0.0",true); ftpClient.SendCommand("OPTS UTF8 ON",true); ftpClient.SendCommand("PWD",true); ftpClient.SetCurrentDirectory("test"); ftpClient.Dir(); ftpClient.SendFile(@"C:\test.zip", "aa.zip", FtpType.Binary); ftpClient.GetFile("aa.zip", @"D:\test.zip", FtpType.Binary); ftpClient.MoveFile("aa.zip", "test"); }