public static File createFile ( String filename ) throws IOException { File file = new File ( filename ) ; if ( ! file . exists ( ) ) { if ( file . getParent ( ) != null ) { File path = new File ( file . getParent ( ) ) ; path . mkdirs ( ) ; } file . createNewFile ( ) ; } return file ; }
Creates a file . The file and the directory structure is created physically if it does not exist already .