Here you can find the source of delFiles(String path)
public static boolean delFiles(String path)
//package com.java2s; /*//from w ww . j av a2 s. c o m * @(#)FileHelper.java Created at 2013-2-24 * * Copyright (c) 2011-2013 azolla.org All rights reserved. * Azolla PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.io.File; import com.google.common.base.Preconditions; public class Main { /** * Delete all document under this directory. * if the file is document delete it. * * @param file document or directory * @return will return true with out false when some empty document delete failure */ public static boolean delFiles(File file) { Preconditions.checkNotNull(file); boolean ret = true; if (file.exists()) { if (file.isDirectory() && file.list() != null) { for (File f : file.listFiles()) { if (!f.isDirectory()) { ret = ret && f.delete(); } } } else { ret = ret && file.delete(); } } return ret; } /** * @see org.azolla.io.FileHelper#delFiles(File) */ public static boolean delFiles(String path) { return delFiles(new File(path)); } }