Java Directory Check checkDir(String dir)

Here you can find the source of checkDir(String dir)

Description

check Dir

License

Open Source License

Declaration

public static boolean checkDir(String dir) 

Method Source Code

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

import java.io.*;

public class Main {
    public static boolean checkDir(String dir) {
        File d = new File(dir);
        boolean ret = d.exists();
        if (ret && d.isFile())
            throw new RuntimeException("wrong directory:" + dir);
        if (!ret) {
            d.mkdirs();/*from   w  w  w .ja  v a2  s. c  o m*/
        }
        return ret;
    }
}

Related

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