title: Determine latest file from SFTP server using Java JSch
body: <p>Is there a way to determine the name of latest file on Unix SFTP server using Java JSch?</p>
  
  <p>I want to copy the latest file from server to local machine. I already have a working code for that. But I'm not able to identify the latest file. The folder contains many files in below format:</p>
  
  <pre class="lang-none prettyprint-override"><code>Some Report dd/MM/yyyy hh:ss
  </code></pre>
  
  <p>I tried the code mentioned in <a href="https://stackoverflow.com/questions/2641286/finding-file-size-and-last-modified-of-sftp-file-using-java">this post</a> but it isn't picking up the latest file. Also the code never seems to stop executing.</p>
  
  <p>Any help would be appreciated.</p>