Here you can find the source of delEmptyPath(String path)
public static void delEmptyPath(String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void delEmptyPath(String path) { File file = new File(path); if (file.exists() && file.isDirectory()) { File[] files = file.listFiles(); if (files != null && files.length > 0) return; if (file.delete()) { delEmptyPath(file.getParent()); }// w ww . j a v a 2 s . c o m } } }