public static File createFolder ( String path , String dest_dir ) throws BeastException { File f = new File ( dest_dir ) ; if ( ! f . isDirectory ( ) ) { try { f . mkdirs ( ) ; } catch ( Exception e ) { logger . severe ( "Problem creating directory: " + path + File . separator + dest_dir ) ; } } String folderPath = createFolderPath ( path ) ; f = new File ( f , folderPath ) ; if ( ! f . isDirectory ( ) ) { try { f . mkdirs ( ) ; } catch ( Exception e ) { String message = "Problem creating directory: " + path + File . separator + dest_dir ; logger . severe ( message ) ; throw new BeastException ( message , e ) ; } } return f ; }
This method returns the existing folder and if it does not exist the method generates it .