Posh-SSH
Posh-SSH copied to clipboard
Unable to specify destination filename with Set-SFTPItem
I would expect to be able to specify the filename for a single file upload. But it appears I need to do this with 2 commands instead.
Expected behavior
Set-SFTPItem -SFTPSession $session -Path SomeFile.ext -Destination CorrectName.ext
SomeFile.ext
should be uploaded from my local machine and stored on the remote machine and named CorrectName.ext
Actual Behavior
Upload fails and error is returned that reads: CorrectName.ext does not exist.
Work Around
-
Set-SFTPItem -SFTPSession $session -Path SomeFile.ext -Destination "./"
-
Move-SFTPItem -SFTPSession $session -Path SomeFile.ext -Destination CorrectName.ext