473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to roll back file delete operation

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);
Feb 24 '09 #1
3 4009
PRR
750 Expert 512MB
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 ...
Feb 24 '09 #2
shweta123
692 Expert 512MB
Hi,

Please refer the following link for your requirement:
http://www.daveamenta.com/2008-05/c-...e-recycle-bin/
Feb 24 '09 #3
tlhintoq
3,525 Expert 2GB
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.
Feb 25 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dominic | last post by:
Hi all, I'm trying to create a temp file by copying from an existing file, perform some operation on the temp file, and then delete it. The code I used is as follow: // First, to copy the...
48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
0
by: Mark Depenbrock | last post by:
--Apple-Mail-2--68472726 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Can not make mysql connection - error log: 030708 08:53:48 mysqld started
1
by: Marc | last post by:
I'm building a service application that monitors a directory using a FileSystemWatcher that captures "create" events. In my "create" event handler, I do all my custom processing of the new file...
1
by: spacehopper_man | last post by:
no "rename" operation in C# !!! - this has been covered in this group before, but I can't find any good answers. what I am trying to do is refresh the content in a file with minimum...
6
by: sam_cit | last post by:
Hi Everyone, I'm using remove() function to delete a file, and i observed the following behavior, Concerned file : sample.txt Operation : i open the file in read mode and don't close the...
82
by: Peter Olcott | last post by:
I need std::vector like capability for several custom classes. I already discussed this extensively in the thread named ArrayList without Boxing and Unboxing. The solution was to simply create...
1
by: sherifffruitfly | last post by:
Hi all, I've got a datagrid bound to a dataset/table. When the OnRowChanging event fires, the handler attempts to Insert the new record into the database. When there's an error with this Insert...
8
by: aki | last post by:
Hi All, I describe the problem as below. A directory( path known) , contains 0 to any number of files . The file names are with following structure : ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.