static boolean deleteDir(File path) throws FileNotFoundException, NullPointerException {
    if (path == null) {
      throw new NullPointerException("Path cannot be null!");
    }
    if (!path.exists()) {
      throw new FileNotFoundException("File not found: " + path);
    }
    boolean result = true;

    if (path.isDirectory()) {
      for (File f: path.listFiles()) {
        result = result & deleteDir(f);
      }
    }
    return result && path.delete();
  }
Deletes a given {@link File}, if it exists. If it doesn't exist, it throws a {@link FileNotFoundException}
If the given {@link File} is a directory, it recursively deletes the files in the directory, before deleting the
directory itself.

@param path Reference to the {@link File} to be deleted
@return True, if it successfully deleted the given {@link File}. False, otherwise.
@throws FileNotFoundException When the given {@link File} does not exist
@throws NullPointerException When the given {@link File} reference is null
samza-core/src/test/java/org/apache/samza/testUtils/FileUtil.java