javaswingjframedelete-filenotepad

Is it possible to delete all those text files (Notepad) that were created while Frame was running after closing the frame?


I want all text files (Notepad) created during run time to be deleted every time I close the program.

For example, while my program was running, files (ex. foods.txt, numbers.txt, and fruits.txt) were created, and I want those files to be deleted when I close or stop the program.

dont know if its possible to make


Solution

  • This definitely is possible. You can do it in several ways:

    All in all you need to make up your mind how to detect the files to be deleted. I'd go for the temp directory. How to create a temporary directory/folder in Java?