Java Directory Delete emptyDir(String dirName)

Here you can find the source of emptyDir(String dirName)

Description

empty Dir

License

MIT License

Declaration

public static boolean emptyDir(String dirName) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *  Copyright ? 2012-2015 eBay Software Foundation
 *  This program is dual licensed under the MIT and Apache 2.0 licenses.
 *  Please see LICENSE for more information.
 *******************************************************************************/

import java.io.File;

public class Main {
    public static boolean emptyDir(String dirName) {
        boolean result = false;

        File dir = new File(dirName);
        if (dir != null && dir.isDirectory()) {
            File[] files = dir.listFiles();
            result = files.length == 0 ? true : false;
        }/*from w ww  . ja v  a  2s . c  om*/

        return result;

    }
}

Related

  1. emptyDir(File dir)
  2. emptyDir(File dir)
  3. emptyDir(File dir)
  4. emptyDir(File dir)
  5. emptyDir(File directory)
  6. emptyDir(String path)
  7. emptyDirectory(File dir)
  8. emptyDirectory(File dir)
  9. emptyDirectory(File dir)