title: Listing files using Sh
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3495609/get-the-newest-file-based-on-timestamp">Get the newest file based on timestamp</a>  </p>
  </blockquote>
  
  
  
  <p>I primary want to select latest dump file from specific folder so i can store in variable and use it import using import script</p>
  
  <p>I want to list specific files from a specific, I tried:</p>
  
  <pre><code>a= $(ls -ltr /home/oracle/testora/MAUL01*.dmp | awk '{print $9}' | tail -1)
  echo $a
  </code></pre>
  
  <p>I want output as:</p>
  
  <pre><code>MAUL01.DP.09-27-2012_09_15.dmp
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>/home/oracle/testora/MAUL01.DP.09-27-2012_09_15.dmp
  </code></pre>
  
  <p>Problems:
  ls is not working for me inside sh (working fine from unix)
  file name is shown with path (I trid using basename, but cannot make it work)</p>