zoukankan      html  css  js  c++  java
  • java创建文件

                  //创建文件
    			SimpleDateFormat df = new SimpleDateFormat(template.getName()+"MM-dd HHmm");//设置日期格式
    			String fileName = df.format(new Date())+".pptx";
    			String fileUrl = "D:" + File.separator + "汽车人才对标管理平台" + File.separator + fileName;
    			File testFile = new File(fileUrl);
    			File fileParent = testFile.getParentFile();//返回的是File类型,可以调用exsit()等方法
    			if (!fileParent.exists()) {
    				fileParent.mkdirs();// 能创建多级目录
    			}
    			if (!testFile.exists())
    				testFile.createNewFile();//有路径才能创建文件
    

      

  • 相关阅读:
    File操作
    集合
    几个python资料地址
    Case1-用list写shoppingcart
    字符串操作
    运算-Dictionary
    运算-list
    Python数据类型
    标准库和库导入
    Pycharm
  • 原文地址:https://www.cnblogs.com/emojio/p/12102226.html
Copyright © 2011-2022 走看看