How can I implement "recycle bin" functionality?
<p>I am working on a Java desktop application in which I need to implement recycle bin functionality. Currently:</p>

<ol>
<li>I copy a file using my desktop application to a folder named recycle bin, and then delete the original file.</li>
<li>I store the destination path in a text file, where the file was deleted, just to restore the file to the original location.</li>
<li>While restoring the file, I just move that file to the original location.</li>
</ol>

<p>My problem is that when a file with the same name is deleted from different locations, all the files moved to the Recycle Bin folder created by me and the old file with the same names are overwritten.</p>

<hr>

<p>How can I sort out this issue? Also, is there any other alternate way to get functionality similar to recycle bin?</p>
