Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ta.speot.is, EBGreen, Scott Chamberlain, DragonLord, 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.

    
@ta.speot.is,OK.but i can't see that in my search.BTW tnx. –  Hamid Jul 1 '13 at 12:22
    
@ta.speot.is: I've renamed the question to How does the Recycle Bin work? –  DragonLord Jul 1 '13 at 14:32

1 Answer 1

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: i.imgur.com/oA8rziH.png

* 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
1  
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
1  
@Szymon Szydelko , Thank you for your answer.it should be up vote! –  Hamid Jul 1 '13 at 12:29
1  
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: i.imgur.com/oA8rziH.png –  Szymon Szydełko Jul 1 '13 at 13:17
1  
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 or ask your own question.