Hi all,
I am writing a FILE SYSTEM DRIVER. I just want to know, what is special about recycle bin folder.
The folder name is actually $RECYCLE.BIN, but it is displayed as “recycle bin”. More over, the items inside recycle bin have unique name. But they are displayed as their original names. How is this made possible. Can someone refer me some reading about it.
Because when i delete a file, my FILE SYSTEM creates a directory $RECYCLE.BIN (which should be created as “recycle bin”)
The “Recycle Bin” is actually implemented by the Windows Shell. From a FS perspective you should see only move file or move directory operations if a user uses “normal” deletes from the shell.
The $RECYCLE.BIN directory actually also builds a Database which captures metadata like the original name, date of deletion, …
(On my Windows 7 PC): For every file / folder deleted there are two object in the $RECYCLE.BIN folder, one named “$I…” with a size of 544 bytes, containing the Metadata, and the original file / folder, named “$R…”. All keep the original extension (or no extension for folders).
So if a users “deletes” a file / directory from the Shell:
* a unique name (maybe some kind of hash, or random) of six characters + original extension is generated
* X:$RECYCLE.BIN<usersid>$I is CREATED, where some metadata is written to * The file / directory is MOVED to X:$RECYCLE.BIN<usersid>$R
The Shell constructs the “Recycle Bin” ListView based on this data by the $I files. If you use the “Restore” Command, the Shell uses the Metadata to do a MOVE $R to the original parent directory.
Thanks GP,
I have managed to fix my problem by setting the attributes to $RECYCLE.BIN folder. The attributes added were SYSTEM and HIDDEN in order to tell the shell this is the recycle bin folder, and it should display it accordingly.