title: Looping through files in a folder Node.JS
body: <p>I am trying to loop through and pick up files in a directory, but I have some trouble implementing it. How to pull in multiple files and then move them to another folder?</p>
  
  <pre><code>var dirname = 'C:/FolderwithFiles';
  console.log("Going to get file info!");
  fs.stat(dirname, function (err, stats) {
      if (err) {
          return console.error(err);
      }
      console.log(stats);
      console.log("Got file info successfully!");
  
      // Check file type
      console.log("isFile ? " + stats.isFile());
      console.log("isDirectory ? " + stats.isDirectory());
  });
  </code></pre>