Hi Guys,
I am facing a issue while trying to upload a file through FTP using PSFTP module which i have highlighted below. From the error i can find that the FTP location is considering both the source and destination path. I am not sure how to fix this
issue. Can someone help me with this.
Code:
Import-Module PSFTP
Set-FTPConnection -Credentials username -Server ftp://servername.com -Session MyTestSession
$FTP = "ftp://servername.com"
$FTPPath = "C:\Users\username\Desktop\Scripts\FTP\testfile.txt"
Add-FTPItem -Path $FTP -LocalPath $FTPPath -Session MyTestSession -Verbose
Error output after the FTP connection is established:
VERBOSE: Performing the operation "Send item: 'C:\Users\username\Desktop\Scripts\FTP\testfile.txt' in ftp location" on target "ftp://servername.com/C:/Users/username/Desktop/Scripts/FTP/testfile.txt".
Add-FTPItem : Exception calling "GetRequestStream" with "0" argument(s): "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)."
At line:5 char:1
+ Add-FTPItem -Path $FTP -LocalPath $FTPPath -Session MyTestSession -Ve ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-FTPItem
Regards
Sathish