org.linkedin.util-core/src/main/java/org/linkedin/util/io/IOUtils.java
public static boolean deleteFile(File file) throws IOException
  {
    if(!file.exists())
      return false;

    File[] files = file.listFiles();

    if(files != null)
    {
      for(int i = 0; i < files.length; i++)
      {
        File childFile = files[i];
        if(childFile.equals(file))
          continue;

        if(childFile.isDirectory())
          deleteFile(childFile);
        else
          childFile.delete();
      }
    }

    return file.delete();
  }
public static boolean deleteFile(File file) throws IOException
  {
    if(!file.exists())
      return false;

    File[] files = file.listFiles();

    if(files != null)
    {
      for(int i = 0; i < files.length; i++)
      {
        File childFile = files[i];
        if(childFile.equals(file))
          continue;

        if(childFile.isDirectory())
          deleteFile(childFile);
        else
          childFile.delete();
      }
    }

    return file.delete();
  }
Deletes the file provided. If it is a directory, recursively deletes a directory and its content.

@param file
@return <code>true</code> if the file was deleted, <code>false</code>
if didn't exist
@throws IOException