title: how to check status of last ftp command
body: <p>I have an automated dos script which gets files from Unix server using <code>ftp</code>. 
  The directory structure follow a general pattern:</p>
  
  <pre><code>/path/to/dir/&lt;changing_dir&gt;/scripts
  </code></pre>
  
  <p>the code is like this: 
      cd /path/to/dir//scripts
      mget *.sh</p>
  
  <p>So, I ftp and get all the scripts using <code>mget</code>. But there are some directories which do not have scripts directory inside them, so when I use this directory path in <code>cd</code> it fails and the mget gets the files from home directory instead of skipping. </p>
  
  <p>Is it possible to check within <code>ftp</code> whether last command was successful or not? </p>