/** * Early Return Style Gauntlet * to delete a directory * * @param dirname name of the directory to delete * @return true if it was successfully deleted. */ boolean deleteDir ( String dirname ) { if ( dirname == null ) return false; File dirFile = new File( dirname); if ( ! dirFile.exists() ) return false; if ( ! dirFile.isDirectory() ) return false; // ensure directory empty if ( dirFile.list().length != 0 ) return false; return dirFile.delete(); }