`

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

 
阅读更多

        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));

分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

Global site tag (gtag.js) - Google Analytics