zoukankan      html  css  js  c++  java
  • 删除TOMCAT服务器上的文件

    deleteFile(文件名称,路径名称);
    public boolean deleteFile(String filename,String filepath){
     String path =ServletActionContext.getServletContext().getRealPath(filepath);;
            String filePath = path + "\" + filename;
            File file = new File(filePath);
            // 如果文件路径所对应的文件存在,并且是一个文件,则直接删除
            if (file.exists() && file.isFile()) {
                if (file.delete()) {
                    return true;
                } else {
                    return false;
                }
            } else {
                file.delete();
             return true;
            }
    }
    ---------------------
    作者:冰凌其
    来源:CSDN
    原文:https://blog.csdn.net/xiao1_1bing/article/details/76198582
    版权声明:本文为博主原创文章,转载请附上博文链接!
  • 相关阅读:
    基本数据类型(int, bool, str)
    万恶之源之运算符
    python基础初识
    leetcode 653. Two Sum IV
    leetcode 16 3Sum Closest
    leetcode15 3Sum
    leetcode 1 Two Sum
    【站立会议】第四天
    【站立会议】第三天
    【站立会议】第二天
  • 原文地址:https://www.cnblogs.com/qiu18359243869/p/10940497.html
Copyright © 2011-2022 走看看