Here you can find the source of deleteEmptyFolder(String... dirNames)
static void deleteEmptyFolder(String... dirNames) throws Exception
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.nio.file.Files; public class Main { static final String JUNIT_SUFFIX = " (JUNIT)"; private static String drive; static void deleteEmptyFolder(String... dirNames) throws Exception { File dir = generateFileObject(dirNames); System.out.println("Deleting folder '" + dir + "'"); try {//from w ww. j ava2 s . c o m Files.delete(dir.toPath()); } catch (IOException e) { throw new Exception(e.getClass().getSimpleName() + " deleting empty folder '" + dir + "' : " + e.getMessage()); } } static File generateFileObject(String... dirNames) { String dirPath = drive + ":"; for (String dirName : dirNames) { dirPath += "\\" + dirName + JUNIT_SUFFIX; } return new File(dirPath); } }