Here you can find the source of remove(String filePath)
public static void remove(String filePath)
//package com.java2s; import java.io.File; public class Main { public static void remove(String filePath) { try {// w w w . j ava 2s .co m File file = new File(filePath); remove(file); } catch (Exception e) { e.printStackTrace(); } } public static void remove(File file) { if (file != null) { if (!file.isDirectory()) { file.delete(); } else { String[] children = file.list(); int size = children.length; for (int i = 0; i < size; i++) { remove(new File(file, children[i])); } file.delete(); } } } }