public static void createParentDirectories(String path){
  File targetFile=new File(path);
  File parent=targetFile.getParentFile();
  if (!parent.exists() && !parent.mkdirs()) {
    throw new IllegalStateException("Couldn't create dir: " + parent);
  }
}

public static void createParentDirectories ( String path ) { File targetFile = new File ( path ) ; File parent = targetFile . getParentFile ( ) ; if ( ! parent . exists ( ) && ! parent . mkdirs ( ) ) { throw new IllegalStateException ( "Couldn't create dir: " + parent ) ; } }
create parent directories if they don ' t exist in a given file path .
