qiu18359243869
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
版权声明:本文为博主原创文章,转载请附上博文链接!

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-18
  • 2021-10-24
  • 2022-01-08
  • 2021-03-30
  • 2021-07-28
  • 2022-02-02
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2021-11-18
  • 2022-12-23
  • 2021-11-18
  • 2021-12-13
  • 2021-08-30
  • 2022-02-06
相关资源
相似解决方案