Java Directory Check checkDir(final String name)

Here you can find the source of checkDir(final String name)

Description

Check input directory integrity.

License

Open Source License

Parameter

Parameter Description
name the name of the directory
inFile the directory

Declaration

public static boolean checkDir(final String name) 

Method Source Code

//package com.java2s;
/*/* w  ww. ja v a 2s.c  o m*/
 * Copyright 2014 Elhuyar Fundazioa
    
This file is part of EliXa.
    
EliXa is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
EliXa is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with EliXa.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.File;

public class Main {
    /**
    * Check input directory integrity.
    * @param name
    * the name of the directory
    * @param inFile
    * the directory
    */
    public static boolean checkDir(final String name) {
        return checkDir(new File(name));
    }

    /**
    * Check input directory integrity.
    * @param name
    * the name of the directory
    * @param inFile
    * the directory
    */
    public static boolean checkDir(final File f) {
        boolean isFailure = true;

        if (!f.isDirectory()) {
            isFailure = false;
        } else if (!f.canRead()) {
            isFailure = false;
        }
        return isFailure;

    }
}

Related

  1. checkDir(final String dirName)
  2. checkDir(String dir)
  3. checkDir(String dir, boolean mustWrite)
  4. checkDir(String directory)
  5. checkDir(String dirName)