Java tutorial
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.IOException; public class Main { public static File createTempDir() throws IOException { File temp; temp = File.createTempFile("encfs-java-tmp", Long.toString(System.nanoTime())); if (!temp.delete()) { throw new IOException("Could not delete temporary file " + temp.getAbsolutePath()); } if (!temp.mkdir()) { throw new IOException("Could not create temporary directory"); } return temp; } }