Java tutorial
//package com.java2s; import java.io.File; public class Main { public static int deleteBlankPath(String path) { File f = new File(path); if (!f.canWrite()) { return 1; } if (f.list() != null && f.list().length > 0) { return 2; } if (f.delete()) { return 0; } return 3; } }