title: In an SFTP session is it possible to copy one remote file to another location on same remote SFTP server?
body: <p>Let say I have a file <code>/home/user/dir1/file.txt</code> on a remote SFTP server. I want to copy this file to lets say <code>/home/user/dir2/file.txt</code>, while I am in a <code>sftp</code> session (I have server which allows only <code>sftp</code> connections, but no <code>ssh</code> connections!) connected to this server?</p>
  
  <p>Is it possible to do so? If yes, what is the command?</p>
  
  <p>For example the following command would rename move a file from one directory to another on the remote server.</p>
  
  <pre><code>sftp&gt; rename dir1/file.txt dir2/file.txt
  </code></pre>
  
  <p>I am looking for a command which would copy a file from one directory to another on the remote server, if one exists.</p>
  
  <p>The work around is to download the file from first location and upload to the second location, but that is not an option when the file in question is a big one and one is working with a slow network connection!</p>