javatemporary-directory

how can I create a temporary folder in java 6?


Possible Duplicate:
Create a temporary directory in Java

Duplicate: stackoverflow.com/questions/375910

Is there a way of creating a temporary folder in java ? I know of File's static method createTempFile, but this will only give me a temporary file.


Solution

  • I've never seen a good solution for this, but this is how I've done it.

    File temp = File.createTempFile("folder-name","");
    temp.delete();
    temp.mkdir();