ftp 命令传输文件

客户端直接输入ftp +ip

get +文件名(从服务器获取文件)

put+文件名(将文件上传至服务器)

退出 exit

远程登陆mysql

命令格式为:mysql -h ip -u root -p -P 3306例如:mysql -h 127.0.0.1 -u root -p -P 3306

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是C#中常用的FTP文件传输命令: 1.连接FTP服务器 ```csharp FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftp.example.com/"); request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; request.Credentials = new NetworkCredential("username", "password"); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); ``` 2.上传文件FTP服务器 ```csharp string filePath = @"C:\example.txt"; string ftpPath = "ftp://ftp.example.com/example.txt"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpPath); request.Method = WebRequestMethods.Ftp.UploadFile; request.Credentials = new NetworkCredential("username", "password"); byte[] fileContents = File.ReadAllBytes(filePath); request.ContentLength = fileContents.Length; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(fileContents, 0, fileContents.Length); } FtpWebResponse response = (FtpWebResponse)request.GetResponse(); ``` 3.从FTP服务器下载文件 ```csharp string ftpPath = "ftp://ftp.example.com/example.txt"; string filePath = @"C:\example.txt";FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpPath); request.Method = WebRequestMethods.Ftp.DownloadFile; request.Credentials = new NetworkCredential("username", "password"); using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) using (Stream responseStream = response.GetResponseStream()) using (Stream fileStream = File.Create(filePath)) { responseStream.CopyTo(fileStream); } ``` 4.删除FTP服务器上的文件 ```csharp string ftpPath = "ftp://ftp.example.com/example.txt"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpPath); request.Method = WebRequestMethods.Ftp.DeleteFile; request.Credentials = new NetworkCredential("username", "password"); FtpWebResponse response = (FtpWebResponse)request.GetResponse();```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值