HOME      BLOG       FORUMS      CONTACT       ABOUT

Creating a directory with sub directory

Creating a directory with sub directory

The mkdirs method of file class is used for creating a direcory and sub directories in Java

import java.io.File;
/**
 * File class examples
 */
public class FileExample  {
	public static void main(String[] args){
		// Create file object representing the directory
		File file = new File("d:\\temp\\dir\\subdir");

		// Create directory and sub directories.
		boolean status = file.mkdirs();

		System.out.println("Directory creation status - "+status);

	}
}

Share

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply