title: Case sensitive file extension and existence checking
body: <p>I need to check whether or not a file exists. Which can be accomplished by <code>File#exists()</code> method. But this existence checking is case sensitive. I mean if I have a file name some_image_file.jpg in code but if physically the file is some_image_file.JPG then this method says that the file doesn't exists. How can I check the file existence with case insensitivity to the extension and get the actual file name?</p>
  
  <p>In my scenario, I have a excel file. Each row contains metadata for files and the filename. In some cases I have only the filename or other cases I can have full path. I am denoting a row as a document.</p>
  
  <p>These files are placed in the server. My job is to </p>
  
  <ul>
  <li>Read the excel file row by row and list all the documents.</li>
  <li>Take out the filename or filepath.</li>
  <li>Create the full path of the file. </li>
  <li>Check if the file exists or not. </li>
  <li>Validate other metadata/information provided in the document.</li>
  <li>Upload the file.</li>
  </ul>
  
  <p>My application throws exception in case the file doesn't exists or if some metadata are invalid.</p>
  
  <p>The excel file is written by the customer and they wrote some file name wrong, I mean if the file physically have the extension in lower case, they have written the extension in upper case, also the converse is true.</p>
  
  <p>I am running the application in unix server.</p>
  
  <p>As the file extensions are not matching so the <code>File#exists()</code> is giving false and eventually my code is throwing exception.</p>
  
  <p>The folders where the files are placed can have 30000 or more files.</p>
  
  <p>What I want is </p>
  
  <ul>
  <li>To take the full path of the file.</li>
  <li>Check if the file exists or not.</li>
  <li>If it does not exists then</li>
  <li>Check the file existence by converting the case of the extension.</li>
  <li>If it doesn't exist after the case conversion then throw exception.</li>
  <li>If it exists, then return the actual file name or file path.</li>
  </ul>
  
  <p>If the file name has file extension something like <strong>.Jpg</strong>, don't know what to do! Should I check it by permuting it by changing the case?</p>