How do I create a random unique filename in a directory (of my choice)?
Note: I don’t want this file in the system temp path but rather in the directory I specify
File.createTempFile()
allows you to specify a directory so:
File uniqueFile = File.createTempFile("post", ".html", new File("/var/www/doc"));