code: public static void recursiveRemoveDir(File directory) throws Exception {
  		if (!directory.exists())
  			throw new IOException(directory.toString() + " do not exist!");
  
  		String[] filelist = directory.list();
  		File tmpFile = null;
  		for (int i = 0; i < filelist.length; i++) {
  			tmpFile = new File(directory.getAbsolutePath(), filelist[i]);
  			if (tmpFile.isDirectory()) {
  				recursiveRemoveDir(tmpFile);
  			} else if (tmpFile.isFile()) {
  				try {
  					tmpFile.delete();
  				} catch (Exception ex) {
  					throw new Exception(tmpFile.toString() + " can not be deleted " + ex.getMessage());
  				}
  			}
  		}
  		try {
  			directory.delete();
  		} catch (Exception ex) {
  			throw new Exception(directory.toString() + " can not be deleted " + ex.getMessage());
  		} finally {
  			filelist = null;
  		}
  	}
docs: This class del a directory recursively,that means delete all files and
  directorys.
  
  @param File
  directory the directory that will be deleted.