title: how to create new directory everyday having its name as current date
body: <pre><code>Date dir = new java.util.Date(System.currentTimeMillis());
  String baseDir = "/home/gaurav/usr/logs/ESBegin/";
  String newDir = createDateBasedDirectory(baseDir, dir);
  
  Logger logger = Logger.getLogger("MyLog1");  
  FileHandler fh;  
  
  try {  
  
      // This block configure the logger with handler and formatter  
      fh = new FileHandler(newDir+"/data.log");  
      logger.addHandler(fh);
      SimpleFormatter formatter = new SimpleFormatter();  
      fh.setFormatter(formatter);  
  
      // the following statement is used to log any messages  
      logger.info(stringifiedJson);  
  
  } catch (SecurityException e) {  
      e.printStackTrace();  
  } catch (IOException e) {  
      e.printStackTrace();  
  }  
  </code></pre>
  
  <p>this will create a folder of todays date but i want to create new folder for everyday and store the log file in new folder....means everyday's folder must have that day's log file
  i have following method to create a folder</p>
  
  <pre><code> public static String createDateBasedDirectory(String baseDirectory, Date argDate) {
          String newDir = null;
  
          if (baseDirectory != null &amp;&amp; argDate != null) {
              try {
                  String format = "yyyy-MM-dd";
                  DateFormat dateFormatter = new SimpleDateFormat(format);
                  String date = dateFormatter.format(argDate);
                  File f = new File(baseDirectory);
                  File files[] = f.listFiles();
                  String dir = null;
                  int baseDirLength = baseDirectory.length();
                  int checkingLength = baseDirLength + format.length() + 3;
  
                  int maxSeqNo = 0;
  
                  for (int i = 0; i &lt; files.length; i++) {
                      if (files[i].isDirectory()) {
                          dir = files[i].toString();
                          if (dir.length() == checkingLength) {
                              String existingDirDate = dir.substring(baseDirLength, baseDirLength + 10);
  
                              if (date.equalsIgnoreCase(existingDirDate)) {
                                  int dirSeqNo = 
                                      Integer.parseInt(dir.substring(baseDirLength + 11, baseDirLength + 10 + 3));
  
                                  if (dirSeqNo &gt; maxSeqNo) {
                                      maxSeqNo = dirSeqNo;
                                  }
                              }
                          }
                      }
                  }
  
                  String currSeq = "" + (maxSeqNo + 1);
                  if (currSeq.length() == 1) {
                      currSeq = "0" + currSeq;
                  }
  
                  newDir = baseDirectory + date;
                  new File(newDir).mkdir();
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
          return newDir;
      }
  </code></pre>
  
  <p>what should i change if in want to create a new folder everyday</p>