您的位置:首页 > 其它

判断该目录下是否存在某个文件

2015-08-12 10:42 211 查看

        String dirPath = request.getSession().getServletContext().getRealPath("/template/html");
        File path = new File(dirPath); 
        if(!path.exists()) path.mkdirs();
        //生成的文件的名字 
        String indexFileName = id+".html";
        //判断是否已经存在该html文件,存在了就直接访问html ,不存在生成html文件  
        String[] indexfileList = path.list(new DirectoryFilter(indexFileName));

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐