Java mkdir -p equivalent

Adam Matan picture Adam Matan · Apr 23, 2012 · Viewed 7.2k times · Source

Possible Duplicate:
Recursively create directory

What's the java-esque way to create a director(ies), and don't complain if it exist?

Quoting the man for mkdir:

-p    Create intermediate directories as required... with this option 
      specified, no error will be reported if a directory given as an 
      operand already exists.

Answer

Romain picture Romain · Apr 23, 2012

Have you tried to read the documentation for java.io.File? The File#mkdirs() does just what you need.