2

c# 代码操作ftp服务器文件 - 我只吃饭不洗碗

 6 months ago
source link: https://www.cnblogs.com/INetIMVC/p/18025336
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

c# 代码操作ftp服务器文件

随笔- 4  文章- 0  评论- 0  阅读-

5122 

好久不见,我又回来了。给大家分享一个最近c#代码操作ftp服务器的代码示例

ContractedBlock.gifExpandedBlockStart.gif

基础类的构造函数和属性

ContractedBlock.gifFtpOperation 中其他的方法
            // FTP 服务器地址
            string ftpServer = "ftp://127.0.0.1:27/";
            // FTP 服务器用户名
            string userName = "Administrator";
            // FTP 服务器密码
            string password = "admin";

            FtpTest ftp = new FtpTest(ftpServer, userName, password);
            //ftp.QueryAll("/Template"); //查询
            ftp.FtpDeleteFolders("");//删除所有
            ftp.FtpUploadFolder("e:\\CoaTemplate", "");//将文件夹的内容上传到根目录
            ftp.FtpUploadFolder(@"D:\GitCode\Blog.Core", "/gitCode/Blog.Core");//将本地文件夹的内容上传到指定目录
            var data = ftp.RecursiveQueryAll("");//查询所有文件信息
            ftp.FtpMoveFolder("/CoaTemplate", "/1/CoaTemplate");//文件夹移动
            ftp.FtpDownloadFolder("/1", "d:\\1\\");    //将ftp服务器的指定文件夹下载到本地目录

 贴了半天代码,都不太行,一会能展开,一会展不开,源码地址放下面了。

项目地址:https://github.com/yycb1994/FtpSiteManager


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK