Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
1.40/5 (3 votes)
See more:
How can I 'undelete' files using C#?
Posted
Comments
Philippe Mori 4-Aug-13 19:53pm    
You should do that manually by restoring file from the recycle bin. If the file is "permanently" deleted, then you should buy some recovery software and use that software.

It does not make much sense to write such code from C#. First of all, once a file is deleted, you cannot be sure if you will be able to recover it. Then doing such program require Advanced knowlegde and a lot of time and testing and finally if it is to be integrated into an application, then the application should delete to the recycle bin (and typically undelete should be done manually from the recycled bin).

You could access the special folder for the recycle bin. I don't know the name specifically, but it should be easy to find with google.
 
Share this answer
 
 
Share this answer
 
Comments
abhitechno 23-Aug-13 8:02am    
yes i would like to know if i can write a simple FAT32 driver that can read all the data (existing & deleted files). Could u please point me to the right direction where i may find an example how to do it, preferably using C or C#.

Thanks in advance
If your file is deleted, not just in the recycle bin, then you can't. At least, not without doing so much p/invoke that you may as well write your program in c++. It's not trivial, it involves low level disk access.
 
Share this answer
 
that easy if you using cache :D
 
Share this answer
 
Comments
Member 10028119 3-May-14 2:38am    
how can i recover data, file and folder through C# .net Application.
Please help me
Use Shell32.dll present in windows->System32
 
Share this answer
 
If it's important file the use recovery software or contact any recovery center then they might be recover that file
 
Share this answer
 
this project will help you:
Undelete a file in NTFS[^]
 
Share this answer
 
Comments
Richard MacCutchan 15-Aug-15 6:08am    
This post is mmore than 5 years old; please do not add to such old questions.

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