title: Retrieving files from Directory Node Js
body: <p>I am using readDirSync to get the files from a Diretory. PLease find the code and error as following.</p>
  
  <pre><code>var fs = require('fs');
  var files = fs.readdirSync('./application/models/');
  for(var i in files) {
    var definition = require('../application/models/'+files[i]).Model;
    console.log('Model Loaded: ' + files[i]);
  }
  </code></pre>
  
  <p>I am getting error for line number 2 .
  ENOENT, No such file or directory './application/models/'    at Object.readdirSync  (fs.js:376:18)</p>
  
  <p>I have application/models on the same dir. I already checked for '/application/models/' and
  'application/models/' but failed. I can see the same thing running on server.</p>
  
  <p>Please help</p>
  
  <p>Thanks</p>