Navin SK
Navin SK

Reputation: 98

Where do the deleted files go after getting deleted in Run-Time in a Java Program?

I have deleted some Files in a Java Program, but I was surprised to see them missing in Recycle Bin? I'm not using any of the IDEs, and is there any way to recover those files?

Upvotes: 0

Views: 558

Answers (1)

Coding Otaku
Coding Otaku

Reputation: 463

To Answer your question, No. Deleting files removes them from the hard disk completely.


But if you want to move files to Trash in the future, Java 9 has an API for it called moveToTrash.
Below Java 9 you'll have to use JNA or libraries that makes use of it like FileUtils.

A related question in stackoverflow - Is it Possible with Java to Delete to the Recycle Bin?

Upvotes: 3

Related Questions