List of utility methods to do Is Directory Valid
boolean | isValidDir(String dirName, boolean allowMissing) is Valid Dir if (dirName == null || dirName.trim().isEmpty()) { return false; dirName = dirName.trim(); File dir = new File(dirName); return dir.isDirectory() || (allowMissing && !dir.exists()); |
boolean | isValidDir(String dirPath, boolean createDir) is Valid Dir try { File dir = new File(dirPath); if (createDir) dir.mkdirs(); return dir.isDirectory(); } catch (Exception e) { return false; |
boolean | isValidDirectory(File directory) is Valid Directory if ((directory == null) || (directory.isHidden()) || (!directory.isDirectory())) { return false; return true; |
boolean | isValidDirectory(File directory) is Valid Directory if (directory != null && directory.exists() && directory.canRead()) { File[] listOfFiles = directory.listFiles(); if (listOfFiles.length != 0) { return true; return false; |
boolean | isValidDirectory(File f) Indicates if the given file is a valid directory. return f.exists() && f.isDirectory() && f.canRead();
|
boolean | isValidDirectory(final File folder) Validates if folder is not null, exists and is a directory. return ((null != folder) && (folder.exists()) && (folder.isDirectory()));
|
boolean | isValidDirectory(String filePath) is Valid Directory if (filePath == null) return false; File f = new File(filePath); return f.exists() && f.isDirectory(); |
boolean | isValidDirectory(String name) Checks whether a given directory contains valid images for classification File f = new File(name); for (String file : f.list()) { if (!isImage(file, false)) { System.out.println("Error: Directory contains non-image file:\n" + file.toString()); return false; return true; ... |
boolean | isValidDirectory(String path) A simple check that the directory path is a valid one for the current OS. File file = new File(path); try { file.getCanonicalPath(); return true; } catch (IOException e) { return false; |