Java File Path Delete delEmptyPath(String path)

Here you can find the source of delEmptyPath(String path)

Description

del Empty Path

License

Open Source License

Declaration

public static void delEmptyPath(String path) 

Method Source Code


//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
        }
    }
}

Related

  1. delAllFiles(File dir, String prefix)
  2. delAllFiles(File dir, String suffix)
  3. delDir(String path)
  4. delDirAndFile(String tempath)
  5. deleleFiles(String regex, String path)
  6. delete(File path)
  7. delete(File path)
  8. delete(File path)
  9. delete(File path)