Posh-SSH icon indicating copy to clipboard operation
Posh-SSH copied to clipboard

Unable to specify destination filename with Set-SFTPItem

Open johnjaylward opened this issue 4 months ago • 0 comments

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

  1. Set-SFTPItem -SFTPSession $session -Path SomeFile.ext -Destination "./"
  2. Move-SFTPItem -SFTPSession $session -Path SomeFile.ext -Destination CorrectName.ext

johnjaylward avatar Oct 12 '24 01:10 johnjaylward