Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,
I want to delete all files and folders from recycle bin using my app.
C#
shl = new Shell();
Folder Recycler = shl.NameSpace(10);

       for (int i = 0; i < Recycler.Items().Count; i++)
       {

           FolderItem FI = Recycler.Items().Item(i);
           string FileName = Recycler.GetDetailsOf(FI, 0);
           label1.Text = FileName.ToString();
           if (Path.GetExtension(FileName) == "")
               FileName += Path.GetExtension(FI.Path);

           //Necessary for systems with hidden file extensions.

           string FilePath = Recycler.GetDetailsOf(FI, 1);

           lbl_tmp.Text = FilePath.ToString();


using above code I got success in retrieving the name of file which are present in recycle bin , but I am unable to delete these file. Can anyone help me in this matter.

Thanks in advance
Posted

 
Share this answer
 
 
Share this answer
 
Comments
AdityaBohra 11-Feb-14 3:42am    
Thanks Snehasish, It's work and done what I really want.
[no name] 11-Feb-14 3:55am    
Glad to help..:)
I searched Google for delete from recycle bin c#[^] and this was the first link - Deleting a single item FROM recycle bin[^]. I glanced through the posts and it seems you have your answer here.

Please do search before you ask.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900