Here you can find the source of deleteFile(File root)
public static boolean deleteFile(File root)
//package com.java2s; import java.io.File; public class Main { public static boolean deleteFile(File root) { if (root.exists()) { if (root.isDirectory()) { File[] files = root.listFiles(); for (int i = 0; i < files.length; i++) deleteFile(files[i]); }//from w w w . j a va 2s . c o m return root.delete(); } return false; } }