public static File createTempDir(final String prefix,final String suffix,final File directory) throws IOException {
  final File dir=File.createTempFile(prefix,suffix,directory);
  if (!dir.delete()) {
    throw new IOException("Could not create directory: " + dir.toString());
  }
  if (!dir.mkdir()) {
    throw new IOException("Could not create directory: " + dir.toString());
  }
  return dir;
}

public static File createTempDir ( final String prefix , final String suffix , final File directory ) throws IOException { final File dir = File . createTempFile ( prefix , suffix , directory ) ; if ( ! dir . delete ( ) ) { throw new IOException ( "Could not create directory: " + dir . toString ( ) ) ; } if ( ! dir . mkdir ( ) ) { throw new IOException ( "Could not create directory: " + dir . toString ( ) ) ; } return dir ; }
creates a new empty directory in the specified directory , using the given prefix and suffix strings to generate its name .
