Connect with Expertise | Find Experts, Get Answers, Share Insights

How to roll back file delete operation

 
Join Date: Jan 2009
Posts: 9
#1: Feb 24 '09
I want to roll back file delete operaion using c#. How can i do it?

I am deleting file using this code,

Expand|Select|Wrap|Line Numbers
  1. File.Delete(fileName);

PRR
E
M
C
 
Join Date: Dec 2007
Posts: 739
#2: Feb 24 '09

re: How to roll back file delete operation


I don't think you can "rollback" or retrieve deleted file... You can however read the contents of file in byte array and keep in memory in case you want to recreate the file ...
shweta123's Avatar
E
C
 
Join Date: Nov 2006
Location: India,Pune
Posts: 686
#3: Feb 24 '09

re: How to roll back file delete operation


Hi,

Please refer the following link for your requirement:
http://www.daveamenta.com/2008-05/c-...e-recycle-bin/
tlhintoq's Avatar
E
C
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 3,476
#4: Feb 25 '09

re: How to roll back file delete operation


If you have to be able to "undelete" maybe you could move items to the trash can rather than do File.Delete(). That way you can move them back out of the trash.
Reply