title: How do I get the files from SFTP server and move them to another folder in bash script?
body: <p>How do I get the one by one files from SFTP server and move them do another folder in Ubuntu bash script?</p>
  <pre><code>#!bin/sh
  FOLDER=/home/SFTP/Folder1/    
  
  sftp SFTP@ip_address    
  cd /home/FSTP/Folder1/    
  for file in &quot;$FOLDER&quot;*
  &lt;&lt;EOF
  cd /home/local/Folder1
  get $file
  EOF
  mv $file /home/SFTP/Done
  done
  </code></pre>
  <p>I know it's not right, but i've tried my best and if anyone can help me, i will appreciate it. Thanks in advance.</p>