- fs.stat会返回文件夹会文件的属性
var fs = require('fs'); var wenwa = function (pathname,callback) {fs.stat(pathname,function (err,data) {if(err) throw err;else{if(data.isDirectory()){var wenheichouwa = function (callback){fs.readdir(pathname,function (err,fileordir) {//console.log(fileordir); callback(fileordir)});};wenheichouwa(function (data) {for (var i=0;i<data.length;i++){wenwa(pathname+"/"+data[i])}})}else{console.log(pathname)}}}); };