Under Windows if I create a file and delete it, than recreate the exact copy of the file in the same place and delete it too, than I will have 2 identical files in the recycle bin with the same name. Where does the system knows which one is which? How can there be two files with the same name? Isn’t the recycle bin a kind of folder too? Does other operation systems do the same when we perform this method on them?
Solution:
The Recycle Bin is not a “normal” folder and, thus, does not have to abide by the same rules you know from regular folders.
When you delete a file, the entry for that file in the file system is marked as deleted. The file itself (or, to be more precise, the data contained in the file) remains in place. Windows will then put a new entry into the file system with a new file name. This entry will refer to the same location in the file system where the original file was located. Additionally, it will keep a reference to the original, deleted file.
If we take a look at the actual contents of the Recycle Bin folder, we see this:
C:$Recycle.Bin>dir /a Volume in drive C is System Volume Serial Number is 7461-FCF4 Directory of C:$Recycle.Bin2013-01-30 16:53 <DIR> .2013-01-30 16:53 <DIR> ..2013-01-30 16:53 <DIR> S-1-5-202011-11-29 15:28 <DIR> S-1-5-21-2370250818-2711005194-4184312249-11652013-04-30 14:36 <DIR> S-1-5-21-395480114-2448312134-3943194674-1000 0 File(s) 0 bytes 5 Dir(s) 74,019,328,000 bytes free
This shows me the folders that were deleted from my C:
drive. If I look into one of those folders, I can see the deleted files with their new names:
C:$Recycle.Bin>dir S-1-5-21-2370250818-2711005194-4184312249-1165 Volume in drive C is System Volume Serial Number is 7461-FCF4 Directory of C:$Recycle.BinS-1-5-21-2370250818-2711005194-4184312249-11652011-11-29 15:04 544 $I8CQG1I.old2011-11-29 15:04 544 $IB7OVE3.attr2011-11-29 15:28 544 $ICLKJI9.csr2011-11-29 15:28 544 $IJS204F.csr2011-11-29 15:04 544 $IMBRKUS.old2011-11-29 15:04 544 $IURO2ZD.old2011-11-29 15:04 544 $IV2TEJ7.pem2011-11-29 15:04 544 $IWDACDF.pem2011-11-29 14:37 21 $R8CQG1I.old2011-11-29 14:41 21 $RB7OVE3.attr2011-11-29 14:35 538 $RCLKJI9.csr2011-11-29 15:11 364 $RJS204F.csr2011-11-29 14:37 37 $RMBRKUS.old2011-11-29 14:37 3 $RURO2ZD.old2011-11-29 14:41 2,613 $RV2TEJ7.pem2011-11-29 14:37 2,973 $RWDACDF.pem 16 File(s) 10,922 bytes 0 Dir(s) 73,465,004,032 bytes free
So, you see, the 2 deleted files in your Recycle Bin are 2 unique instances that don’t conflict with each other (although, there would be a conflict if you tried to restore both at the same time).