Here you can find the source of delFile(String path)
public static void delFile(String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void delFile(String path) { File file = new File(path); if (file.exists() && file.isFile()) { file.delete();/*from w ww . j a v a2s . co m*/ } else if (file.exists() && file.isDirectory()) { File[] files = file.listFiles(); if (files != null) { for (File f : files) { if (f != null) { delFile(f.getAbsolutePath()); } } } } } }