How can the recycle bin hold multiple files with the same name?

3

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?

2 files with the same name in recycle bin

totymedli

Posted 2013-05-01T09:19:08.453

Reputation: 4 004

Question was closed 2013-05-02T16:21:48.757

1The recycle bin cannot, and does not, hold information about multiple files with the same name. It does, however, information about multiple files with the same name. So long as it doesn't store the file's original name in the file name, this doesn't cause the recycle bin to hold multiple files with the same name. So there's a million ways to make this work and one way to make it not work -- they just don't do it the one way that wouldn't work. – David Schwartz – 2013-05-01T09:50:07.083

Answers

9

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.Bin

2013-01-30  16:53    <DIR>          .
2013-01-30  16:53    <DIR>          ..
2013-01-30  16:53    <DIR>          S-1-5-20
2011-11-29  15:28    <DIR>          S-1-5-21-2370250818-2711005194-4184312249-1165
2013-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.Bin\S-1-5-21-2370250818-2711005194-4184312249-1165

2011-11-29  15:04               544 $I8CQG1I.old
2011-11-29  15:04               544 $IB7OVE3.attr
2011-11-29  15:28               544 $ICLKJI9.csr
2011-11-29  15:28               544 $IJS204F.csr
2011-11-29  15:04               544 $IMBRKUS.old
2011-11-29  15:04               544 $IURO2ZD.old
2011-11-29  15:04               544 $IV2TEJ7.pem
2011-11-29  15:04               544 $IWDACDF.pem
2011-11-29  14:37                21 $R8CQG1I.old
2011-11-29  14:41                21 $RB7OVE3.attr
2011-11-29  14:35               538 $RCLKJI9.csr
2011-11-29  15:11               364 $RJS204F.csr
2011-11-29  14:37                37 $RMBRKUS.old
2011-11-29  14:37                 3 $RURO2ZD.old
2011-11-29  14:41             2,613 $RV2TEJ7.pem
2011-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).

Der Hochstapler

Posted 2013-05-01T09:19:08.453

Reputation: 77 228