title: How to get latest timestamp file from FTP using UNIX Script
body: <p>I am writing a shell script; I want to download latest uploaded file from FTP. I want to get latest file of specific folder. Below is my code for that. But it is not working as expected.</p>
  
  <p>File names are in specific format like
  </p>
  
  <pre><code>.../MONTHLY_FILE/
        ABC_ECI_12082015.ZIP
        ABC_ECI_18092015.ZIP
        ABC_ECI_09102015.ZIP
  </code></pre>
  
  <p>Here my return filename should be <code>"ABC_ECI_09102015.ZIP"</code>.
  Please help me out in this and let me know what mistake I am making.</p>
  
  <pre><code>#!/bin/ksh
  . ospenv
  #SRC_DIR=/powerm/Myway/SrcFiles
  SRC_DIR=$PMRootDir/SrcFiles
  cd $SRC_DIR
  ftp -n gate.usc.met.com  &lt;&lt; FINISH
  user ftp_abc.com xyz 
  ##Here xyz is password
  cd /MONTHLY_FILE
  #mget ls -t -r | tail -n 1`enter code here`
   get $1
  bye
  FINISH
  </code></pre>