PutFileToDirectory Gives Wrong Error Message
When I call
The directory (
Here's the output:
the name of the server file which will be written.
The error message should read:
PutFileToDirectory
to a server directory that does not exist, it correctly throws an exception. However, the error message is incorrect. Here's the code:
$fullFileName = $file.fullName if ((Test-Path -path $fullFileName -pathType leaf) -eq $false) { throw "File $fullFileName does not exist" } $directory = Get-PathBelowRoot -clientRoot $clientRoot -file $file $remove = $false $session.PutFileToDirectory($fullFileName, $directory, $remove, $options)
bib
) does not exist on the server, so an exception thrown, as expected.
Here's the output:
The message clearly says I'm trying to create a server file calledSending file 'C:\Users\Dick\Documents\tch\ssh\client\bib\bibliography.htm'
Write-Error: Exception calling "PutFileToDirectory" with "4" argument(s): "Cannot create remote file '/C:/Users/Dick/bib/bibliography.htm'.
No such file or directory.
Error code: 2 Error message from server: No such file"
/C:/Users/Dick/bib/bibliography.htm
. But that's the client file being sent, not
the name of the server file which will be written.
The error message should read:
The server is OpenSSH Server. Is this error message coming from the server? If not, is it something you can fix?Write-Error: Exception calling "PutFileToDirectory" with "4" argument(s): "Cannot create remote file '/bib/bibliography.htm'. No such file or directory.
Error code: 2 Error message from server: No such file"