Here you can find the source of deleteEmptyDirectory(File fileOrDirectory)
public static void deleteEmptyDirectory(File fileOrDirectory)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void deleteEmptyDirectory(File fileOrDirectory) { if (fileOrDirectory.isDirectory()) { if (fileOrDirectory.list().length == 0) { //System.out.println("deleting " + fileOrDirectory.getName()); fileOrDirectory.delete(); }//from w ww .j a v a 2 s . c om } } }