자바(Java)

자바 오늘 날짜로 디렉토리(폴더) 만들기

xemaker 2017. 12. 5. 08:15
프로그래밍을 하다보면 오늘 날짜로 디렉토리 만들어야 할 일이 많다.

DateFormat dfFormat = new SimpleDateFormat("yyyyMMdd");

    Date nowDate = new Date();

    String toDate = format.dfFormat(nowDate);

    String filePath = toDate+"/";

    String fullPath=rootPath+filePath;

    File file = new File(fullPath);

    if(!file.isDirectory){

        file.mkdirs();

    }