title: SFTP bash shell script to copy the file from source to destination
body: <p>I have created one script to copy the local files to the remote folder. The script is working fine outside of <code>if</code> condition. But when I  enclosed inside the <code>if</code> condition the <code>put</code> command is not working. It logged into the remote server using SFTP protocol and when exist it's showing the error:</p>
  <blockquote>
  <p>put command not found</p>
  </blockquote>
  <p>See what is happening after executing the script:</p>
  <pre class="lang-none prettyprint-override"><code>Connected to 10.42.255.209.
  sftp&gt; bye
  sftp.sh: line 23: put: command not found
  </code></pre>
  <p>Please find the below script.</p>
  <pre><code>echo -e;
  echo -e &quot;This script is used to copy the files&quot;;
  sleep 2;
  
  localpath=/home/localpath/sftp
  remotepath=/home/destination/sftp/
  
  if [ -d $localpath ]
   then
     echo -e &quot;Source Path found&quot;
     echo -e &quot;Reading source path&quot;
     echo -e &quot;Uploading the files&quot;
     sleep 2;
  
          sftp username@10.42.255.209
          put $localpath/* $remotepath
  
  else
  </code></pre>