Here you can find the source of deleteMultipleFiles(String filePath, int numberOfFiles)
public static void deleteMultipleFiles(String filePath, int numberOfFiles)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void deleteMultipleFiles(String filePath, int numberOfFiles) { for (int i = 0; i < numberOfFiles; i++) { deleteRecursively(new File(filePath + "." + (i + 1))); }//from w w w. ja va2 s. c om } public static void deleteRecursively(File file) { if (!file.exists()) { return; } if (file.isDirectory()) { for (File child : file.listFiles()) { deleteRecursively(child); } } if (!file.delete()) { throw new RuntimeException("Couldn't empty database."); } } }