views:

230

answers:

3

Hi,

is there anyway in C# (interop maybe) to delete a specific file in the recycle bin permanently?

While searching on the internet I only found ways to delete TO the recycle bin not FROM. I also don't want to empty the whole bin, just one specific file. The specific item is already in the recycle bin.

How can I do this?

EDIT:

  1. I didn't put the file there myself, nor my program. Somebody else did so I have no control over that.
  2. Windows Search somehow is able to find my file...?!?

I found out another thing, I can actually find a file in C:\RECYCLER with the same file extension but a different name. So how can I tell if that is really the file I'm looking for?

Thanks

A: 

This may be a stupid question, but did the file go into the recycle because your program put it there? If so, you can just delete the file using normal file operations and bypass the recycle bin entirely.

Mr. Shiny and New
no somebody else but it there
oreon
A: 

I never tried it but you can search for the item you want to delete in the hidden folder "RECYCLER" that each unit has, and delete it.

Jonathan
Windows Search can actually do that, but for some reasons GetFiles() returns some weird other files not even in my recycle bin.I can't seem to get the file I'm actually looking forUnfortunately...
oreon
+1  A: 

Based on the following post on .NETMonster: http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-framework/2766/Recycle-Bin-with-C

You need to check out PInvoke.

Jesse
Ah I hoped it wouldn't come to this...I'll have a look
oreon