question: public static boolean deleteFiles ( File directory ) { boolean result = true ; if ( directory . isDirectory ( ) ) { File [ ] list = directory . listFiles ( ) ; for ( int i = list . length ; i -- > 0 ; ) { File file = list [ i ] ; if ( file . isFile ( ) ) { result = result && file . delete ( ) ; } } } return result ; }
target:  Deletes all files and directories in the specified directory. Nothing happens when the specified File is not a directory.