Java Is Directory Valid isValidDir(String dirPath, boolean createDir)

Here you can find the source of isValidDir(String dirPath, boolean createDir)

Description

is Valid Dir

License

Open Source License

Declaration

public static boolean isValidDir(String dirPath, boolean createDir) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean isValidDir(String dirPath, boolean createDir) {
        try {/*  w ww .j  a  v  a  2 s.  c om*/
            File dir = new File(dirPath);
            if (createDir)
                dir.mkdirs();
            return dir.isDirectory();
        } catch (Exception e) {
            return false;
        }

    }
}

Related

  1. isValidDir(String dirName, boolean allowMissing)
  2. isValidDirectory(File directory)
  3. isValidDirectory(File directory)
  4. isValidDirectory(File f)
  5. isValidDirectory(final File folder)