How to create a random unique file name in a directory (of my choice)?
Note. . I do not want this file to be in the system time path, but in the directory that I specified
File.createTempFile() allows you to specify a directory like this:
File.createTempFile()
File uniqueFile = File.createTempFile("post", ".html", new File("/var/www/doc"));
You need an overload of File.createTempFile(String, String, File) .
File.createTempFile(String, String, File)
What would you see right away if you bother to look at the documentation.