Home > Blockchain >  Alternative for File.createTempFile?
Alternative for File.createTempFile?

Time:05-08

I don't want the extra number after file name when it is created using createTempFile. But I believe it is not possible to remove them. (How to change default name in createTempFile?).

In my case file name is very important. I cannot use new File() as it will create a file in local every-time.

Can someone suggest alternatives?

CodePudding user response:

You can create a temporary directory, which will be created in the directory that according to your operating system is the right place to create temporary directories, using Files.createTempDirectory(...).

In the directory that you created that way, you can create any file you like, using any filename you like.

  • Related