Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I want to understand why objects in the Recycle Bin don't need to be renamed when two or more objects have same name. In other places, two objects cannot have the same name: we are forced to rename them.

share|improve this question

marked as duplicate by, EBGreen, Scott Chamberlain, bwDraco, Karan Jul 1 '13 at 16:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.,OK.but i can't see that in my search.BTW tnx. – Hamid Jul 1 '13 at 12:22 I've renamed the question to How does the Recycle Bin work? – bwDraco Jul 1 '13 at 14:32
up vote 13 down vote accepted

Contrary to @tikend, files are not saved in their old path and just marked as deleted. Instead, files are moved to the $Recycle.Bin directory at the root of drive. Inside, there are folders named something like S-1-5-21-4284498480-1431815607-1764836822-1001 (actual example)*, and inside those are the deleted files.

Why we can have two files with same name in Trash? Because their names are mangled. Instead of sumthinFunny.cpp we have $RYDITY2.cpp. Those identifiers make it possible to have two files with the same name.

How does Widows know where the file was deleted from? It stores the file’s metadata (like path in question, file attributes, and so on) in the $IYDITY2.cpp file. Inside, there is path to the original directory.

By the way, if you open $Recycle.Bin from Windows Explorer, it appears empty. You can see it if you mount drive from Linux, or through a other file manager, like Total Commander.

BTW2: While file names are mangled into $RYDITY2.cpp like form, when you open their properties, you get something that looks like UUID:

* This folder name is the SID of the user who deleted the file.

Edited in order to bring comments' wisdom here.

share|improve this answer
Yeah, I mixed it with something else, they relative path is stored in recycle bin thou, so they can be restored. – tikend Jul 1 '13 at 12:26
@Szymon Szydelko , Thank you for your should be up vote! – Hamid Jul 1 '13 at 12:29
AFAIK relative path is stored either as resource fork, xattr, somewhere in %windir% or in registry. Why? Because structure of mentioned folder is flat eg. there are no Users, Program Files and so on directories. However, if you delete whole direcrory, is is moved there like it would be one file, with filenames inside unmangled! – Szymon Szydełko Jul 1 '13 at 12:31
More facts! While file names are mangled into $RYDITY2.cpp like form, when you open their properties, you get something that looks like UUID: – Szymon Szydełko Jul 1 '13 at 13:17
The folder names are the SIDs of the users who have deleted files. As well as the $R.. files there are corresponding $I.. files which contain metadata for the deleted files, including the original name. You can see inside $Recycle.bin if you are an administrator and turn of both file hiding parameters. – David Marshall Jul 1 '13 at 13:17

Not the answer you're looking for? Browse other questions tagged .