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

Set-SCPFile - Different Destination Filename

Open thecliguy opened this issue 7 years ago • 16 comments

In version 1.7: "On Set-SCPFile the parameter RemoteFile is now changed to RemotePath and one only needs to give the Path to where to copy the file."

A consequence of this change is that if you want the destination filename to differ from the source, you now have to copy the file and then rename it. This extra step is time consuming when dealing with large numbers of files.

Would it be possible to reinstate the ability to specify a different destination file name?

thecliguy avatar Jun 10 '17 00:06 thecliguy

Will add it as a feature request

Sent from my iPhone

On Jun 9, 2017, at 8:42 PM, thecliguy [email protected] wrote:

In version 1.7: "On Set-SCPFile the parameter RemoteFile is now changed to RemotePath and one only needs to give the Path to where to copy the file."

A consequence of this change is that if you want the destination filename to differ from the source, you now have to copy the file and then rename it. This extra step is time consuming when dealing with large numbers of files.

Would it be possible to reinstate the ability to specify a different destination file name?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Jun 10 '17 01:06 darkoperator

Any ETA on when this feature will be added

dvanurag1308 avatar May 03 '18 19:05 dvanurag1308

None at the moment. Working on the .Net 2.0 core version

From: Anurag Sent: Thursday, May 3, 2018 3:29 PM To: darkoperator/Posh-SSH Cc: Carlos Perez; Comment Subject: Re: [darkoperator/Posh-SSH] Set-SCPFile - Different DestinationFilename (#152)

Any ETA on when this feature will be added — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar May 03 '18 19:05 darkoperator

implemented it in to the next release 2.1, I should have it out next week

darkoperator avatar Jan 08 '19 13:01 darkoperator

@darkoperator Just wondered if you're planning to release 2.1 soon?

thecliguy avatar Feb 07 '19 10:02 thecliguy

It is in the PS gallery already

Sent from my iPhone

On Feb 7, 2019, at 6:30 AM, thecliguy [email protected] wrote:

@darkoperator Just wondered if you're planning to release 2.1 soon?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Feb 07 '19 11:02 darkoperator

Ah OK, so you don't publish releases on Github anymore? https://github.com/darkoperator/Posh-SSH/releases

thecliguy avatar Feb 07 '19 11:02 thecliguy

Need tondo that. Thanks for reminding me

Sent from my iPhone

On Feb 7, 2019, at 7:56 AM, thecliguy [email protected] wrote:

Ah OK, so you don't publish releases on Github anymore? https://github.com/darkoperator/Posh-SSH/releases

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Feb 07 '19 12:02 darkoperator

This doesn't seem to work in 2.1.

:>Set-SFTPFile -SFTPSession $sftpSession -Localfile "file.csv" -RemotePath "newfile.csv" VERBOSE: Uploading D:\TEMP\file.csv VERBOSE: Uploading to newfile.csv/file.csv on sftp.site.com Set-SFTPFile : newfile.csv does not exist.

:> Get-Module Posh-SSH

ModuleType Version Name ExportedCommands


Manifest 2.1 Posh-SSH {Get-SCPFile, Get-SCPFolder, Get-SCPItem, Get-SFTPFile...}

matthpi avatar Apr 02 '19 15:04 matthpi

Can you try Set-SFTPItem? The Set-SFTPFile one will be deprecated im the next releaee

Sent from my iPhone

On Apr 2, 2019, at 11:28 AM, Matt Houston [email protected] wrote:

This doesn't seem to work in 2.1.

:>Set-SFTPFile -SFTPSession $sftpSession -Localfile "file.csv" -RemotePath "newfile.csv" VERBOSE: Uploading D:\TEMP\file.csv VERBOSE: Uploading to newfile.csv/file.csv on sftp.site.com Set-SFTPFile : newfile.csv does not exist.

:> Get-Module Posh-SSH

ModuleType Version Name ExportedCommands

Manifest 2.1 Posh-SSH {Get-SCPFile, Get-SCPFolder, Get-SCPItem, Get-SFTPFile...}

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Apr 02 '19 15:04 darkoperator

Set-SFTPItem. Does not work either. I also noticed this issue is for Set-SCPFile, not Set-SFTPFile... sorry for the confusion. I think it would be nice to have this for SFTP too.

PS D:\TEMP> Set-SFTPItem -SFTPSession $sftpSession -Path "file.csv" -Destination "newFile.csv" VERBOSE: Uploading D:\TEMP\file.csv to newFile.csv Set-SFTPItem : newFile.csv does not exist.

PS D:\TEMP> Set-SFTPItem -SFTPSession $sftpSession -Path "file.csv" -Destination "/newFile.csv" VERBOSE: Uploading D:\TEMP\file.csv to /newFile.csv Set-SFTPItem : /newFile.csv does not exist.

matthpi avatar Apr 02 '19 15:04 matthpi

@darkoperator Just a reminder to publish the latest release on Github: https://github.com/darkoperator/Posh-SSH/releases

thecliguy avatar Apr 02 '19 15:04 thecliguy

I tend to do releases directly to the gallery. Any reason for pushing them to GitHub? I tend to not support manual installs.

On Apr 2, 2019, at 11:52 AM, thecliguy [email protected] wrote:

@darkoperator https://github.com/darkoperator Just a reminder to publish the latest release on Github: https://github.com/darkoperator/Posh-SSH/releases https://github.com/darkoperator/Posh-SSH/releases — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/152#issuecomment-479063675, or mute the thread https://github.com/notifications/unsubscribe-auth/AAf0HouXDUQeKqP4oThpdKWys09DW_qzks5vc3zQgaJpZM4N19NL.

darkoperator avatar Apr 02 '19 16:04 darkoperator

Set-SFTPItem. Does not work either. I also noticed this issue is for Set-SCPFile, not Set-SFTPFile... sorry for the confusion. I think it would be nice to have this for SFTP too.

PS D:\TEMP> Set-SFTPItem -SFTPSession $sftpSession -Path "file.csv" -Destination "newFile.csv" VERBOSE: Uploading D:\TEMP\file.csv to newFile.csv Set-SFTPItem : newFile.csv does not exist.

PS D:\TEMP> Set-SFTPItem -SFTPSession $sftpSession -Path "file.csv" -Destination "/newFile.csv" VERBOSE: Uploading D:\TEMP\file.csv to /newFile.csv Set-SFTPItem : /newFile.csv does not exist.

You need to specify the Path not the file name on the target host. If you want a new file name on the target you can use the NewName parameter.

''' PS C:\WINDOWS\system32> help Set-SCPItem -Examples

NAME Set-SCPItem

SYNOPSIS Upload an item, either file or directory to a remote system via SCP.

Example 1

PS C:\> Set-SCPItem -ComputerName 192.168.1.169 -Credential carlos -Path .\testcode -Destination /tmp -Verbose
VERBOSE: Using SSH Username and Password authentication for connection.
VERBOSE: Fingerprint for 192.168.1.169: 5a:a3:85:c6:63:83:6b:6c:2a:8f:9b:44:20:70:eb:7c
VERBOSE: Fingerprint matched trusted fingerprint for host 192.168.1.169
VERBOSE: Connection successful
VERBOSE: Uploading: C:\testcode
VERBOSE: Destination: /tmp/testcode

Uploade a directory to the target folder.

PS C:\WINDOWS\system32> help Set-SCPItem -Parameter Path

-Path <String> Path of the item to upload.

Required?                    true
Position?                    2
Default value                None
Accept pipeline input?       True (ByPropertyName)
Accept wildcard characters?  false

PS C:\WINDOWS\system32> help Set-SCPItem -Parameter NewName

-NewName <String> New name for the item on the destination path.

Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       True (ByPropertyName)
Accept wildcard characters?  false

'''

darkoperator avatar Apr 02 '19 16:04 darkoperator

@darkoperator Perhaps you ought to add a note the Readme.md to say that you do not intend to publish any further releases to Github - because to the casual browser of the project it gives the impression of not having had a release since 2017.

thecliguy avatar Apr 02 '19 16:04 thecliguy

Any chance we can get a NewName option for Set-SFTPItem?

jimbowatusi avatar Sep 22 '23 08:09 jimbowatusi