java 根據系統時間建立資料夾

2021-09-24 22:37:30 字數 610 閱讀 9004

目錄

1. 示意圖

2. 基本思路

3. **如下

* 在指定目錄下根據系統時間建立資料夾

* 檔案名字eg:2019-07-02-23-56-31

** @param path 路徑:eg: "/users/amarao/業餘/剪輯/output/";

* 結果:建立成功/users/amarao/業餘/剪輯/output/2019-07-03-10-28-05

** 步驟:

* 1. 讀取系統時間

* 2. 格式化系統時間

* 3. 建立資料夾

** 參考:

*/

public static file createfilebysystime(string path) 

}system.out.println("建立成功" + newpath);

return file;

}

Java根據日期動態建立資料夾

如下示例 為在e盤的根目錄下建立日期格式 精確到天 的資料夾,並在該資料夾中建立乙個txt檔案。date date new date string path e new dateformat yyyy mm dd format date 如果不存在,建立資料夾 file f new file pat...

建立資料夾 取當前系統時間

windows md date 0,10 2007 10 20 md date 0,4 date 5,2 date 8,2 20071020 md date 2,2 date 5,2 date 8,2 091211 md date 0,4 date 5,2 date 8,2 time 0,2 tim...

建立資料夾

當某資料夾不存在時,建立資料夾 import os path dir file if not os.path.exists path dir os.makedirs path dir 同時建立資料夾有兩種函式,os.mkdir和os.makedirs,兩者的區別在於前者是一級一級建立檔案目錄,後者可...