- rm(absoluteFilePath, function (error, result) {
- if (error) return next(new HttpError(500, 'Unable to remove'));
+ if (result.isDirectory() && !recursive) return next(new HttpError(403, 'Is directory'));
+
+ // add globs to get file listing
+ if (result.isDirectory()) absoluteFilePath += '/**';
+
+ rm(absoluteFilePath, { dryRun: dryRun }).then(function (result) {
+ result = result.map(removeBasePath);