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

J

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
 
J

jjkboswell

Hello (e-mail address removed),

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top