Java Directory Create mkdir(File parent, String... segments)

Here you can find the source of mkdir(File parent, String... segments)

Description

mkdir

License

Open Source License

Declaration

public static File mkdir(File parent, String... segments) throws IOException 

Method Source Code

//package com.java2s;
/*/*from  w  w w  .ja  v  a2s  . co  m*/
 * JBoss, Home of Professional Open Source.
 * Copyright 2013, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

import java.io.File;

import java.io.IOException;

public class Main {
    public static File mkdir(File parent, String... segments) throws IOException {
        File dir = parent;
        for (String segment : segments) {
            dir = new File(dir, segment);
        }
        dir.mkdirs();
        return dir;
    }
}

Related

  1. mkdir(File f)
  2. mkdir(File f)
  3. mkDir(File file)
  4. mkdir(File file)
  5. mkdir(File file)
  6. mkdir(File parentDir, String name)
  7. mkdirs(File dir)
  8. mkdirs(File dir)
  9. mkdirs(File dir)