protected boolean deleteDirectory ( Path path , boolean cleanParent ) throws IOException { boolean pathExists = deleteIfExistsRecursively ( path ) ; if ( pathExists && cleanParent ) { cleanEmptyParentDirectory ( path . getParent ( ) ) ; return true ; } return false ; }
Deletes a directory and optionally removes the parent directory if it becomes empty .