Java Create Directory mkdir(String name, File dir)

Here you can find the source of mkdir(String name, File dir)

Description

mkdir

License

Apache License

Declaration

private static void mkdir(String name, File dir) throws IOException 

Method Source Code


//package com.java2s;
/*//from w w  w . j  a  v a  2  s.c  om
 * Copyright 2005-2010 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.File;

import java.io.IOException;

public class Main {
    private static void mkdir(String name, File dir) throws IOException {
        if (!dir.exists()) {
            if (!dir.mkdir()) {
                throw new IOException(name + " create fail!");
            }
        }
    }
}

Related

  1. mkdir(String folderpath)
  2. mkDir(String fullPath, String directoryPath)
  3. mkdir(String mkdirName)
  4. mkdir(String name)
  5. mkdir(String name)
  6. mkdir(String path)
  7. mkdir(String path)
  8. mkDir(String path)
  9. mkdir(String s)