Here you can find the source of emptyDir(String dirName)
public static boolean emptyDir(String dirName)
//package com.java2s; /******************************************************************************* * Copyright ? 2012-2015 eBay Software Foundation * This program is dual licensed under the MIT and Apache 2.0 licenses. * Please see LICENSE for more information. *******************************************************************************/ import java.io.File; public class Main { public static boolean emptyDir(String dirName) { boolean result = false; File dir = new File(dirName); if (dir != null && dir.isDirectory()) { File[] files = dir.listFiles(); result = files.length == 0 ? true : false; }/*from w ww . ja v a 2s . c om*/ return result; } }