Powershell FTP - “远程服务器返回错误:(550)文件不可用

时间:2013-08-08 15:59:48

标签: powershell ftp

我正在尝试将单个文件复制到FTP服务器。我在网上找到了这个代码,但无法让它工作。我收到以下错误消息:

Exception calling "UploadFile" with "2" argument(s): "The remote server returned an error: (550) File unavailable (e.g., file
no access)."
At C:\bin\Put-FTP.ps1:22 char:1
+ $webclient.UploadFile($uri, $File)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

知道为什么会这样吗?我检查了目标FTP服务器,该用户可以完全访问写入,读取,删除和列出内容。

谢谢!

$File = "C:\bin\emp1.xlsx"
$ftp = "ftp://user:password@ftp.server.com/User/emp1.xlsx"
"ftp url: $ftp"

$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)

"Uploading $File..."

$webclient.UploadFile($uri, $File)

0 个答案:

没有答案
相关问题