title: Check any files exist, in a given folder
body: <p>I've updated my code to handle the listed scenario
  1. Check for empty directory
  2. Check if the file exist</p>
  
  <p>What other things I should be looking out for when I'm trying to do a filewatch program?</p>
  
  <p>I want to be able to create something that can cover all the possible scenario that could happen when monitoring the file such that when i deploy the code, I can quickly read the output and know what happened</p>
  
  <pre><code>package filemon;
  
  import java.io.File;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.Calendar;
  
  /**
   * @author LAI XUEYANG
   * @version $Revision: 1.0 $
   */
  public class filemon {
  
      /**
       * Method main.
       * 
       * @param args
       *            String[]
       */
      public static void main(String[] args) {
  
          // Declare yesterday date with format as yyyyMMdd
          DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
          // Calendar yesterdayCal = Calendar.getInstance();
  
          // Declare today date with format as yyyyMMdd
          Calendar todayCal = Calendar.getInstance();
          String todayDate = dateFormat.format(todayCal.getTime());
  
          // Declaration of folder path
          File file = new File("D:\\TEST");
  
          // Declaration of file path
          Path filePath = Paths.get(file + "\\INCIF" + todayDate + ".txt");
  
          // yesterdayCal.add(Calendar.DATE, -1);
          // String yesterdayDate = dateFormat.format(yesterdayCal.getTime());
  
          try {
              checkEmptyDirectory(file, filePath);
          } catch (Exception e) {
              System.out.println(e);
          }
          // checkFileExist();
      }
  
      /**
       * Method checkFileExist.
       * 
       * @param filePath
       *            Path
       */
      private static void checkFileExist(Path filePath) {
          if (Files.exists(filePath)) {
              System.out.println("Filename: " + filePath.toString());
              System.out.println("Exist in location!");
          } else {
              System.out.println("Filename: " + filePath.toString());
              System.out.println("Does not exist in location!");
          }
      }
  
      /**
       * Method checkEmptyDirectory.
       * 
       * @param file
       *            File
       * @param filePath
       *            Path
       */
      private static void checkEmptyDirectory(File file, Path filePath) {
          if (file.isDirectory()) {
              if (file.list().length &gt; 0) {
                  checkFileExist(filePath);
              } else {
                  System.out
                          .println("Directory specified does not contain any files!");
              }
          } else {
              System.out.println("Directory specified does not exist!");
          }
      }
  }
  </code></pre>