🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 ``` /** * @category 文件删除 * @param filepath * 入参|待删除的文件或目录|{@link java.lang.String} * @return 0 失败<br/> * 1 成功<br/> */ @InParams(param = { @Param(name = "filepath", comment = "待删除的文件或目录", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) @Component(label = "文件删除", style = "判断型", type = "同步组件", version = "1.0.0", deprecated = false, author = "test", date = "2018-01-23 09:49:44") public static ResultBase P_deleteFile(String filepath) { boolean blnRet = false; File file = new File(filepath); if (!file.exists()) { blnRet = true; } else if (file.isFile()) { blnRet = file.delete(); } else { blnRet = deleteDirectory(filepath); } return blnRet ? ResultBase.newSuccessResult() : ResultBase .newFailureResult("TPTF0027", "删除文件目录失败"); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/b9/4d/b94d61425672ae6c36856cbaf7c7034d_1870x893.png) # 参数说明及示例 ## 入口参数 待删除的文件或目录:待删除的文件或目录绝对路径,示例: `"D:\\work\\CQYY\\workspace\\abc.txt"`