public static boolean isEmptyDirectory ( Resource res , ResourceFilter filter ) { if ( res . isDirectory ( ) ) { Resource [ ] children = filter == null ? res . listResources ( ) : res . listResources ( filter ) ; if ( children == null || children . length == 0 ) return true ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( children [ i ] . isFile ( ) ) return false ; if ( children [ i ] . isDirectory ( ) && ! isEmptyDirectory ( children [ i ] , filter ) ) return false ; } } return true ; }
return Boolean . True when directory is empty Boolean . FALSE when directory s not empty and null if directory does not exists