文件名称:c# 编写ftplib客户端
文件大小:55KB
文件格式:RAR
更新时间:2016-12-06 12:15:28
C# ftp server
开源ftp客户端 使用介绍 static void Main(string[] args) { using (FtpConnection ftp = new FtpConnection("192.168.1.209", 21, "softland", "123456")) { ftp.Open(); /* Open the FTP connection */ ftp.Login(); /* Login using previously provided credentials */ if (ftp.FileExists("CBXLic.exe")) /* check that a file exists */ ftp.GetFile("CBXLic.exe", false); /* download /incoming/file.txt as file.txt to current executing directory, overwrite if it exists */ //do some processing try { ftp.SetCurrentDirectory("/"); ftp.PutFile(@"C:\Users\zhangxiufeng\Documents\oraclelinuxdown.png", "oraclelinuxdown.png"); /* upload c:\localfile.txt to the current ftp directory as file.txt */ } catch (FtpException e) { Console.WriteLine(String.Format("FTP Error: {0} {1}", e.ErrorCode, e.Message)); } foreach (var dir in ftp.GetDirectories("/")) { Console.WriteLine(dir.Name); Console.WriteLine(dir.CreationTime); foreach (var file in dir.GetFiles()) { Console.WriteLine(file.Name+" "+file.LastWriteTime.ToString()); } } ftp.Close(); }
【文件预览】:
TestFtpClient
----bin()
--------Debug()
----TestFtpClient.csproj.user(168B)
----TestFtpClient.csproj(3KB)
----ftp.cs(15KB)
----Program.cs(2KB)
----obj()
--------Debug()
----FtpHelper.cs(12KB)
----Properties()
--------AssemblyInfo.cs(1KB)