标签:var cal for tor path mdi delete director stat
删除文件
var fs = require(‘fs‘); fs.unlink(path,callback);
删除文件夹
deleteFolder(path); function deleteFolder(path) { var files = []; if( fs.existsSync(path) ) { files = fs.readdirSync(path); files.forEach(function(file,index){ var curPath = path + "/" + file; if(fs.statSync(curPath).isDirectory()) { // recurse deleteFolder(curPath); } else { // delete file fs.unlinkSync(curPath); } }); fs.rmdirSync(path); } }
标签:var cal for tor path mdi delete director stat
原文地址:http://www.cnblogs.com/bruce-gou/p/6082167.html