public static void deleteRecursively ( @ NonNull final File file ) throws IOException { Condition . INSTANCE . ensureNotNull ( file , "The file or directory may not be null" ) ; if ( file . isDirectory ( ) ) { for ( File child : file . listFiles ( ) ) { deleteRecursively ( child ) ; } } delete ( file ) ; }
Deletes a specific file or directory . If the file is a directory all contained files and subdirectories are deleted recursively .