title: how to add folders in subdirectory in java?
body: <p><a href="https://i.stack.imgur.com/6ya8y.png" rel="nofollow noreferrer">reference</a>   </p>
  
  <pre><code> `String pathname = "C:/sata1/pm8/data/pmin/";`
      String year ="UNKNOWN";
      year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
      String yearM = "UNKNOWN";
      yearM = new SimpleDateFormat("yyyyMM").format(new Date());
      String yearD ="UNKNOWN";
      yearD =new SimpleDateFormat("yyyyMMdd").format(new Date());
      pathname+=year+"/"+yearM+ "/"+yearD;
      File directory;
      directory = new File(pathname);
      if (!directory.exists()){
          directory.mkdirs();
      }
  </code></pre>
  
  <p>This is what I tried. This makes the directory and subdirectory like this
  <code>C:\sata1\pm8\data\pmin\2017\201709\20170919</code>. Now I have to make the 4 folders under <code>20170919</code>.</p>
  
  <pre><code>Directory(sata1) 
  └── subDirectory(pm8) 
        └── subDirectory(data) 
              └── subDirectory(pmin) 
                    └── subDirectory(year) 
                      └── subDirectory(yearM) 
                          └── subDirectory(yearD) 
                                    ├── folder1 
                                    ├── folder2 
                                    └── folder3  like this
  </code></pre>