public static void deleteFile(String destDirPath) {
        String property = System.getProperty("os.name");
        if (property.toLowerCase().startsWith("win")) {
            logger.info("当前系统为Windows不进行文件清理");
            return;
        }
        logger.info("开始删除相同文件 destDirPath:{}", destDirPath);

        Process p;
        InputStreamReader inputStreamReader = null;
        BufferedReader br = null;
        String co = "rm -rf " + destDirPath;
        try {
            p = Runtime.getRuntime().exec(co);
            inputStreamReader = new InputStreamReader(p.getInputStream());
            br = new BufferedReader(inputStreamReader);
            int returnCode = p.waitFor();
            logger.info("执行删除任务完毕 删除命令:{} 时间:{}", co, returnCode);
        } catch (IOException e) {
            logger.error("clearFile IOException:{}", e);
        } catch (InterruptedException e) {
            logger.error("clearFile InterruptedException:{}", e);
        } finally {
            StreamClose.close(inputStreamReader, br);//关闭流
        }
    }
GitHub 加速计划 / li / linux-dash
10
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:19 天前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐