直接上代码吧
import fs from '@ohos.file.fs';
try {
let context = getContext(this);
let fileDir = context.filesDir;
let filePath = fileDir ;
fs.rmdir(filePath)
} catch (e) {
console.log('')
}