Here you can find the source of isEmptyDir(Path path)
public static boolean isEmptyDir(Path path)
//package com.java2s; //License from project: Apache License import java.nio.file.*; public class Main { public static boolean isEmptyDir(Path path) { try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(path)) { return !dirStream.iterator().hasNext(); } catch (Exception e) { // logger.warn("Problem occured while checking is directory empty {}", path); }//w ww . j a va 2 s. c o m return false; } }