`

powershell Ftp 脚本

阅读更多

 

Powershell Ftp 上传:

 

$ftp = [System.Net.FtpWebRequest]::Create("ftp://hostdomain/filename")

$ftp = [System.Net.FtpWebRequest]$ftp

$ftp.Method = [System.Net.WebRequestMethods+Ftp]::UploadFile

$ftp.Credentials = new-object System.Net.NetworkCredential("UserName","Password")

$ftp.UseBinary = $true

$ftp.UsePassive = $true

$content = [System.IO.File]::ReadAllBytes("The file path to be upload in local computer")

$ftp.ContentLength = $content.Length

$rs = $ftp.GetRequestStream()

$rs.Write($content, 0, $content.Length)

$rs.Close()

$rs.Dispose()

2
3
分享到:
评论
2 楼 Michae1Youn9 2016-06-28  
如果像实现断点续传应该怎么改呢?求问
1 楼 Michae1Youn9 2016-06-28  
在使用的时候,出现一个错误
使用“0”个参数调用“close”时发生异常:“基础连接已经关闭:接收时发生错误。”
已经传了三分之一后出现的,这个是什么原因呢?

相关推荐

Global site tag (gtag.js) - Google Analytics