LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to make sure deleted files are put into trash can so that I can undelete them. (http://www.linuxquestions.org/questions/linux-general-1/how-to-make-sure-deleted-files-are-put-into-trash-can-so-that-i-can-undelete-them-50634/)

futurist 03-19-2003 08:14 AM

How to make sure deleted files are put into trash can so that I can undelete them.
 

How to do this in linux.
I accidently delete file and it can not be undeleted!!!




NGene 03-19-2003 09:00 AM

Do you mean having a trashcan when you work at the command line and are using the rm command? If this is the case, take a look at something called Undo RM:

http://www.the-labs.com/UndoRM/

It works only at the command line, and I haven't used it myself so I don't know if it's any good...

bulliver 03-19-2003 01:12 PM

Or you can use a simple shell script. Create a directory in your home directory called 'trash' (if you don't already have it, you may have one in ~/Desktop/Trash) then a simple script:
Code:

#!/bin/bash
mv $1 ~/Desktop/Trash

Save it as 'del' or whatever, chmod it 755, then put it in your path (/bin, or /usr/bin is a good place). Then to use it:
del myfile
will move it to the trash for you.

cuckoopint 03-19-2003 08:19 PM

Quote:

Or you can use a simple shell script. Create a directory in your home directory called 'trash' (if you don't already have it, you may have one in ~/Desktop/Trash) then a simple script:
you may also want some cron job to remove the contents once in a while - it could take up a lot of space if not watched correctly. But then again, if you know you're going to need it, why delete it in the first place.
:D

bulliver 03-20-2003 02:30 AM

Well, the point is that sometimes you may not know you need the file. Plus sometimes you just don't pay close enough attention to what you're typing...


All times are GMT -5. The time now is 03:36 AM.