var fs = require('fs'),
path = require('path')
;
var targetPath = "C:\\Users\\××××\\Desktop\\ss\\oo\\fdfd\\palipala\\"
;
function mkdir(dir){
var dirname = path.dirname(dir)
;
if(!fs.existsSync(dirname)){
mkdir(dirname);
}
return fs.mkdirSync(dir,0755);
}
mkdir(targetPath);
4 回复
var fs = require('fs'),
path = require('path')
;
var targetPath = "C:\\Users\\××××××\\Desktop\\ss\\oo\\sss\\dsdas\\"
;
function mkdir(dir){
var dirname = path.dirname(dir),
stat
;
if(!fs.existsSync(dirname)){
console.log(dirname);
mkdir(dirname);
}
if(!fs.existsSync(dir)){
fs.mkdirSync(dir,0755);
}
else{
return;
}
}
mkdir(targetPath);