NAzT
9/19/2013 - 4:10 AM

readdir.js

readdir.js

var dir = './'; // your directory

var files = fs.readdirSync(dir);
files.sort(function(a, b) {
               return fs.statSync(dir + a).mtime.getTime() - 
                      fs.statSync(dir + b).mtime.getTime();
           });


var files = fs.readdirSync(dir)
              .map(function(v) { 
                  return { name:v,
                           time:fs.statSync(dir + v).mtime.getTime()
                         }; 
               })
               .sort(function(a, b) { return a.time - b.time; })
               .map(function(v) { return v.name; });



var files = fs.readdirSync(dir).map(function(v) { 
  //var info = fs.statSync(dir+v);
	return { 
		name: v, 
		stat: fs.statSync(dir+v)
	} 
})


var files = fs.readdirSync(dir).map(function(v) { var info = fs.statSync(dir+v); return { name: v, time: { atime: info.atime, mtime: info.mtime, ctime: info.ctime}, /*info: info,*/ size: info.size } })