Home All Groups Group Topic Archive Search About

How to get the folder name for the Windows recycle bin?

Author
23 Mar 2007 3:32 PM
jjkboswell
Bearing in mind the Windows recycle bin folder has had 3 names since
Win 95 up to Vista:
x:\RECYCLED (95, 98)
x:\RECYCLER (NT, XP, 2000, 2003)
x:\$Recycle.bin (Vista)

Consider iterating through the the root folder of a drive, and
excluding the recycle bin from your results.  It is unacceptable to
simply ignore folders named "RECYCLED", "RECYCLER" or "$Recycle.bin"
by string comparison because, for example, a Vista user may have
created their own "Recycled" folder.

Is there a set of constants for these folders, or a way of discovering
the recycle bin folder for a given volume in .NET?

Consider too that the drive might not be local, and may be accessed
remotely by system share (e.g. \\machine\C$\)

Boz

Author
23 Mar 2007 5:07 PM
Michael Nemtsev
Hello jjkbosw***@yahoo.com,

AFAIK use SHGetSpecialFolderLocation with BITBUCKET flag

---
WBR,  Michael  Nemtsev [C# MVP]. 
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

Show quote
> Windows recycle bin folder has had 3 names since
> Win 95 up to Vista:
Author
29 Mar 2007 3:28 PM
jjkboswell
On 23 Mar, 18:07, Michael Nemtsev <nemt***@msn.com> wrote:
Show quote
> Hello jjkbosw***@yahoo.com,
>
> AFAIK use SHGetSpecialFolderLocation with BITBUCKET flag
>
> ---
> WBR,  Michael  Nemtsev [C# MVP]. 
> My blog:http://spaces.live.com/laflour
> Team blog:http://devkids.blogspot.com/
>
> "The greatest danger for most of us is not that our aim is too high and we
> miss it, but that it is too low and we reach it" (c) Michelangelo
>
>
>
> > Windows recycle bin folder has had 3 names since
> > Win 95 up to Vista:- Hide quoted text -
>
> - Show quoted text -

Thanks for the response.  Unfortunately that will only work when
finding the recycle bin folder for the machine the process is running
on.  There's no way of specifying a remote volume or share.

What I really need to do is get the file system and use that to
determine the recycle bin folder, but I can't think how to distinguish
a remote normal NTFS file system from a Vista NTFS file system.

Any thoughts?

Boz

AddThis Social Bookmark Button