[ 
https://issues.apache.org/jira/browse/SSHD-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941043#comment-17941043
 ] 

Thomas Wolf commented on SSHD-1345:
-----------------------------------

OpenSSH uses a non-standard extension "po...@openssh.com", not a normal SFTP 
rename. If you want to use this, you could do for instance
{code:java}
boolean done = false;
if 
(sftpClient.getServerExtensions().keySet().contains(PosixRenameExtensionParser.NAME))
 {
    OpenSSHPosixRenameExtension extension = 
sftpClient.getExtension(OpenSSHPosixRenameExtension.class);
    if (extension != null) {
        extension.posixRename(oldPath, newPath);
        done = true;
    }
}
if (!done) {
  sftpClient.rename(oldPath, newPath);
}{code}

> SftpClient.rename() is copying the file and then deleting the original file
> ---------------------------------------------------------------------------
>
>                 Key: SSHD-1345
>                 URL: https://issues.apache.org/jira/browse/SSHD-1345
>             Project: MINA SSHD
>          Issue Type: Bug
>            Reporter: Chandra Sekhar R
>            Priority: Major
>
> I am using Apache Mina SSHD SFTP to rename a file on sftp server. Calling 
> SftpClient.rename() method to do the same. But this method is copying the 
> source file to destination file and then deleting the source file.
> But when I do the same usings sftp client binary comes with linux the file is 
> just renamed. 
> How to acheive renaming of file using SftpClient ?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to