How to create directories recursively in java?

Below java code shows how to create directories recursively –

/****************************************************************************************
 * Created on 03-2012 Copyright(c) http://kodehelp.com All Rights Reserved.
 ****************************************************************************************/
package com.kodehelp.javaio;

import java.io.File;

/**
 * Created by http://kodehelp.com
 * Date: 03/05/2012
 */
public class RecursiveDirectoryCreation {

	public static void main(String[] args) {
		String directories = "C:\\001\\002\\003\\004\\005\\006\\007\\008\\009";
        File file = new File(directories);

        boolean passFail = file.mkdirs();
        System.out.println("Directory Creation Status = " + passFail);

	}

}

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.