static public boolean createMissingParentDirectories ( File file ) { File parent = file . getParentFile ( ) ; if ( parent == null ) { // Parent directory not specified, therefore it's a request to // create nothing. Done! ;) return true ; } // File.mkdirs() creates the parent directories only if they don't // already exist; and it's okay if they do. parent . mkdirs ( ) ; return parent . exists ( ) ; }
Creates the parent directories of a file . If parent directories not specified in file s path then nothing is done and this returns gracefully .