views:

63

answers:

2

I need to be able to build all directories up to and including the directory specified by my File object. For example, suppose I have something like this:

File file = new File( "/var/a/b/c/d/" );

But only /var/ exists. I need a method that builds up to d, and I was wondering if there was a method in a java io library somewhere that does this already.

+10  A: 

mkdirs() in java.io.File does the trick.

File file = new File("/var/a/b/c/d");

file.mkdirs();
Joey Gibson
+2  A: 

File.mkdirs()

pajton