Question:
Is it possible to copy a remote file on the SFTP server to file w/ a different name/path also on the remote server? In other words, I do not want to upload or download a file, but I want to have the SFTP server make a copy of the file. Is this possible?
This is not possible to do using the SFTP protocol. If you examine the protocol specification (http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02) you'll see that the possible packet types (i.e. commands) that can be sent from the client to the server are as follows:
#define SSH_FXP_INIT 1 #define SSH_FXP_VERSION 2 #define SSH_FXP_OPEN 3 #define SSH_FXP_CLOSE 4 #define SSH_FXP_READ 5 #define SSH_FXP_WRITE 6 #define SSH_FXP_LSTAT 7 #define SSH_FXP_FSTAT 8 #define SSH_FXP_SETSTAT 9 #define SSH_FXP_FSETSTAT 10 #define SSH_FXP_OPENDIR 11 #define SSH_FXP_READDIR 12 #define SSH_FXP_REMOVE 13 #define SSH_FXP_MKDIR 14 #define SSH_FXP_RMDIR 15 #define SSH_FXP_REALPATH 16 #define SSH_FXP_STAT 17 #define SSH_FXP_RENAME 18 #define SSH_FXP_READLINK 19 #define SSH_FXP_SYMLINK 20 #define SSH_FXP_STATUS 101 #define SSH_FXP_HANDLE 102 #define SSH_FXP_DATA 103 #define SSH_FXP_NAME 104 #define SSH_FXP_ATTRS 105 #define SSH_FXP_EXTENDED 200 #define SSH_FXP_EXTENDED_REPLY 201
There is no feature to "copy" a file. It is possible to rename a file.
To make a copy of a file, one could instead use the Chilkat SSH API to remotely login and issue a remote "cp" command (or "copy" if the server is Windows).