public static boolean delete ( final File aDir ) { if ( aDir . exists ( ) && aDir . listFiles ( ) != null ) { for ( final File file : aDir . listFiles ( ) ) { if ( file . isDirectory ( ) ) { if ( ! delete ( file ) ) { LOGGER . error ( MessageCodes . UTIL_012 , file ) ; } } else { if ( file . exists ( ) && ! file . delete ( ) ) { LOGGER . error ( MessageCodes . UTIL_012 , file ) ; } } } } else if ( LOGGER . isDebugEnabled ( ) && aDir . listFiles ( ) == null ) { LOGGER . debug ( MessageCodes . UTIL_013 , aDir ) ; } return aDir . delete ( ) ; }
Deletes a directory and all its children .