我有此问题,我的机器上有以“ $ TPMAB”,“ $ TPMBC”,“ $ TPMCD”等开头的目录。我想删除这些目录中的子目录。我同时使用了rimraf和fs-extra npm库。他们没有给出任何错误。但是在运行之后,仍然可以看到子目录。
removeIncludedCommonFolders: function(coFolderPathsArr){
coFolderPathsArr.forEach(folderPath => {
let folderName = folderPath.substring(folderPath.lastIndexOf('/')+1);
if(folderName.charAt(0) === '$'){
var commonIncludedPath = path.join(folderPath,'includes',Config.COMMON_FOLDER_NAME);
//commonIncludedPath = Users/imadhushanka/Desktop/web/src/fef/$TpmUserL1/includes/common-autogenerated-new
rimraf(commonIncludedPath,err => {
if (err) {
throw new Error(`Cannot remove folder at ${folderPath}.${err}`);
}
});
}
});
}