HOME      BLOG       FORUMS      CONTACT       ABOUT

Create a directory using java

Create a directory using java

The mkdir method of file class is used for creating a new directory 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");

		// Create directory
		boolean status = file.mkdir();

		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