1 | "use strict";
|
2 |
|
3 | const path = require('path');
|
4 | const fs = require('fs');
|
5 | const isDirectorySync = require('./isDirectorySync');
|
6 |
|
7 | function deleteFolderRecursive(file_path) {
|
8 | var files = [];
|
9 | if(fs.existsSync(file_path)) {
|
10 | files = fs.readdirSync(file_path);
|
11 | files.forEach(function(file) {
|
12 | var curfile_path = path.join(file_path, file);
|
13 | if(isDirectorySync(curfile_path)) {
|
14 | deleteFolderRecursive(curfile_path);
|
15 | } else {
|
16 | fs.unlinkSync(curfile_path);
|
17 | }
|
18 | });
|
19 | fs.rmdirSync(file_path);
|
20 | }
|
21 | }
|
22 |
|
23 |
|
24 | module.exports = deleteFolderRecursive;
|
25 |
|