title: ftp script in bash
body: <p>I have the following script that pushes files to remote location:   </p>
  
  <pre><code>#!/usr/bin/bash
  HOST1='a.b.c.d'
  USER1='load'
  PASSWD1='load'
  DATE=`date +%Y%m%d%H%M`
  DATE2=`date +%Y%m%d%H`
  DATE3=`date +%Y%m%d`
  FTPLOGFILE=/logs/Done.$DATE2.log
  D_FOLDER='/dir/load01/input'
  
  PUTFILE='file*un'
  ls $PUTFILE | while read file
  do
    echo "${file} transfered at $DATE" &gt;&gt; /logs/$DATE3.log
  done
  
  ftp -n -v $HOST1 &lt;&lt;SCRIPT &gt;&gt; ${FTPLOGFILE} 2&gt;&amp;1
  quote USER $USER1
  quote PASS $PASSWD1
  cd $D_FOLDER
  ascii
  prompt off
  mput /data/file*un 
  quit
  SCRIPT
  
  mv *un test/
  
  ls test/*un | awk '{print("mv "$1" "$1)}' | sed 's/\.un/\.processed/2' |sh
  rm *unl
  </code></pre>
  
  <p>I am getting this error output:</p>
  
  <pre>200 PORT command successful.
  553 /data/file1.un: A file or directory in the path name does not exist.
  200 PORT command successful.</pre>