tomcat下创建文件夹存储文件

    技术2022-07-20  72

    @ResponseBody //请假时间,效验时间重复 1通过->没有重复值 0->请假时间重复 @RequestMapping(value = "/test", method = RequestMethod.GET) public String test() { String property = System.getProperty("user.dir"); property=property.substring(0,property.lastIndexOf("\\")); SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd"); File file=new File(property+"/webapps/"+sdf.format(new Date())); if(!file.exists()){ file.mkdirs(); } String path = file.getAbsolutePath(); System.out.println("path===="+path);//tomcat文件夹 return property; }

     

    Processed: 0.008, SQL: 9