Isn't the trash a feature of the Gnome GUI, not the shell? Using "rm" has always scared me, so I've recently configured my system thus:
Install trash-cli. See http://code.google.com/p/trash-cli/ Alias "del" to trash-put. <http://code.google.com/p/trash-cli/>Set a cron job to clean trash after xxx days. You probably could alias rm to trash-put, but trash-put doesn't support all the flags of rm and this would be uncharted waters... Kevin On Wed, Jul 28, 2010 at 3:18 PM, Bos, Roger <roger....@rothschild.com>wrote: > Ubuntu also uses ~ as a backup file syntax, but Ubuntu has a trash can > where deleted files are located, so it would be easy to restore them. I > would be surprised if Fedora didn't also have a trash can. > > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Duncan Murdoch > Sent: Wednesday, July 28, 2010 11:12 AM > To: Jarrod Hadfield > Cc: r-help@r-project.org; Marc Schwartz > Subject: Re: [R] [Rd] R CMD build wiped my computer > > On 28/07/2010 10:01 AM, Jarrod Hadfield wrote: > > Hi Marc, > > > > Thanks for the info on recovery - most of it can pieced together from > > backups but a quick, cheap and easy method of recovery would have been > > > nicer. > > > > My main concern is that this could happen again and that the "bug" is > > not limited to R 2.9. I would think that an accidental carriage return > > > at the end of a file name (even a temporary one) would be a reasonably > > > common phenomenon (I'm surprised I hadn't done it before). > > > > If you can put together a recipe to reproduce the problem (or a less > extreme version of R deleting files it shouldn't), we'll certainly fix > it. But so far all we've got are guesses about what might have gone > wrong, and I don't think anyone has been able to reproduce the problem > on current R. > > Duncan Murdoch > > Cheers, > > > > Jarrod > > > > > > > > On 28 Jul 2010, at 14:04, Marc Schwartz wrote: > > > > > Jarrod, > > > > > > Noting your exchange with Martin, Martin brings up a point that > > > certainly I missed, which is that somehow the tilde ('~') character > > > got into the chain of events. As Martin noted, on Linuxen/Unixen > > > (including OSX), the tilde, when used in the context of file name > > > globbing, refers to your home directory. Thus, a command such as: > > > > > > ls ~ > > > > > > will list the files in your home directory. Similarly: > > > > > > rm ~ > > > > > > will remove the files there as well. If the -rf argument is added, > > > then the deletion becomes recursive through that directory tree, > > > which appears to be the case here. > > > > > > I am unclear, as Martin appears to be, as to the steps that caused > > > this to happen. That may yet be related in some fashion to Duncan's > > > hypothesis. > > > > > > That being said, the use of the tilde character as a suffix to > > > denote that a file is a backup version, is not limited to Fedora or > > > Linux, for that matter. It is quite common for many text editors > > > (eg. Emacs) to use this. As a result, it is also common for many > > > applications to ignore files that have a tilde suffix. > > > > > > Based upon your follow up posts to the original thread, it would > > > seem that you do not have any backups. The default ext3 file system > > > that is used on modern Linuxen, by design, makes it a bit more > > > difficult to recover deleted files. This is due to the unlinking of > > > file metadata at the file system data structure level, as opposed to > > > > simply marking the file as deleted in the directory structures, as > > > happens on Windows. > > > > > > There is a utility called ext3undel > > > (http://projects.izzysoft.de/trac/ext3undel > > > ), which is a wrapper of sorts to other undelete utilities such as > > > PhotoRec and foremost. I have not used it/them, so cannot speak from > > > > personal experience. Thus it would be a good idea to engage in some > > > reviews of the documentation and perhaps other online resources > > > before proceeding. The other consideration is the Catch-22 of not > > > copying anything new to your existing HD, for fear of overwriting > > > the lost files with new data. So you would need to consider an > > > approach of downloading these utilities via another computer and > > > then running them on the computer in question from other media, such > > > > as a CD/DVD or USB HD. > > > > > > A more expensive option would be to use a professional data recovery > > > > service, where you would have to consider the cost of recovery > > > versus your lost time. One option would be Kroll OnTrack UK > > > (http://www.ontrackdatarecovery.co.uk/ > > > ). I happen to live about a quarter mile from their world HQ here in > > > > a suburb of Minneapolis. I have not used them myself, but others > > > that I know have, with good success. Again, this comes at a > > > potentially substantial monetary cost. > > > > > > The key is that if you have any hope to recover the deleted files, > > > you not copy anything new onto the hard drive in the mean time. > > > Doing so will decrease the possibility of file recovery to near 0. > > > > > > As Duncan noted, there is great empathy with your situation. We have > > > > all gone through this at one time or another. In my case, it was > > > perhaps 20+ years ago, but as a result, I am quite anal retentive > > > about having backups, which I have done for some time on my systems, > > > > hourly. > > > > > > HTH, > > > > > > Marc Schwartz > > > > > > > > > On Jul 28, 2010, at 5:55 AM, Jarrod Hadfield wrote: > > > > > >> Hi Martin, > > >> > > >> I think this is the most likely reason given that the name in the > > >> DESCRIPTION file does NOT have a version number. Even so, it is > > >> very easy to misname a file and then delete it/change its name (as > > >> I've done here) and I hope current versions of R would not cause > > >> this problem. Perhaps Fedora should not use ~ as its back up file > > >> suffixes? > > >> > > >> Cheers, > > >> > > >> Jarrod > > >> > > >> > > >> On 28 Jul 2010, at 11:41, Martin Maechler wrote: > > >> > > >>>>>>>> Jarrod Hadfield <j.hadfi...@ed.ac.uk> on Tue, 27 Jul 2010 > > >>>>>>>> 21:37:09 +0100 writes: > > >>> > > >>>> Hi, I ran R (version 2.9.0) CMD build under root in Fedora (9). > > >>>> When it tried to remove "junk files" it removed EVERYTHING in my > > >>>> local account! (See below). > > >>> > > >>>> Can anyone tell me what happened, > > >>> > > >>> the culprit may lay here: > > >>>>> * removing junk files > > >>>>> unlink MCMCglmm_2.05/R/ residuals.MCMCglmm.R > > >>>>> ~ > > >>> > > >>> where it seems that someone (you?) have added a newline in the > > >>> filname, so instead of 'residuals.MCMCglmm.R~' > > >>> you got > > >>> > > >>> 'residuals.MCMCglmm.R > > >>> ~' > > >>> > > >>> and the unlink / rm command interpreted '~' as your home > > >>> directory. > > >>> > > >>> But I can hardly believe it. > > >>> This seems explanation seems a bit doubtful to me.. ... > > >>> > > >>>> and even more importantly if I can I restore what was lost. > > >>> > > >>> well, you just get it from the backup. You do daily backups, do > > >>> you? > > >>> > > >>> Regards, > > >>> Martin Maechler, ETH Zurich > > >>> > > > > > > > > > > > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > *************************************************************** > > This message is for the named person's use only. It ma...{{dropped:18}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.