peter-vilja / gulp-clean

A gulp plugin for removing files and folders from given paths.
177 stars 21 forks source link

slow to delete folders on windows #16

Open michaeldewayneharris opened 9 years ago

michaeldewayneharris commented 9 years ago

running this batch file will delete them 1/4 of the time so its a problem with gulp-clean or its dependencies.

del /f/s/q folder > nul
rmdir /s/q folder
michaeldewayneharris commented 9 years ago

here is some code that deletes folders fast using the above batch commands in a node friendly way. However, this should probably be added to clean on a lower level.

gulp.task('clean', function() {
 var exec = require("gulp-exec");
 return gulp.src(['.tmp', '.dist'], {
            read: false
        })
        .pipe(exec('del /f/s/q <%= file.path %> > nul'))
        .pipe(exec('rmdir /s/q <%= file.path %>'));
});