# 前言
const fs = require('fs');
const path = require('path');
const _ = require('lodash');
// 需要删除的文件名
const list = [];
// 需要处理的文件夹列表
const docsList = [
'controller/v1',
'service',
'model',
'routes/v1',
'extend',
'middleware',
];
docsList.forEach(filePath => {
const fileList = fs
.readdirSync(path.resolve(__dirname, filePath))
.filter(f => list.indexOf(f) > -1);
console.log(fileList);
fileList.forEach(name => {
fs.unlinkSync(path.resolve(__dirname, filePath, name));
console.log(name + '文件删除成功');
});
});