var
fs = require(
'fs'
);
var path ="D:\abc\d";
path =
path.replace("\\", "/");//这句是关键,如果不替换,下面的exits总为false;
fs.exists(path,
function
(exists){
if
(exists){
console.log(
"该文件或目录存在!"
);
}
else
{
console.log(
"该文件或目录不存在!"
);
}
});