I am using psftp's put command to upload files. I am not providing the filename in destination location assuming that the file will be copied with the same name. Here's the help page of put command
psftp> help put
put [ -r ] [ -- ] <filename> [ <remote-filename> ]
Uploads a file to the server and stores it there under
the same name, or under a different one if you supply the
argument <remote-filename>.
If -r specified, recursively store a directory.
If I try to use PUT without filename in the destination location, psftp throws the error open for write: failure
psftp> open user@host
Using username "user".
Remote working directory is /
psftp> put <file_name> ./<dir>/
/<dir>: open for write: failure
Whereas if I provide the filename in the destination location, it works
psftp> put <file_name> ./<dir>/<file_name>
local:<file_name> => remote:/<dir>/<file_name>
Why does the PUT command require filename in the destination location?
What the help page means that the whole
<remote-filename>argument is optional, not filename part of the argument.So you can do this
It uploads the file to the current remote working directory, under the same file name.
But you cannot do:
You can do this though: