LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > ultimate_linux
User Name
Password

Notices


Rate this Entry

alternative to rm command

Posted 06-16-2010 at 09:00 AM by ultimate_linux

i've seen many users deleting files and reporting how to recover them.
instead of recovering i've thought of redirecting the files deleted to trash.so,that it might be helpful to recover them.
here's how i do it.

1.take a variable,for example:TRASHPATH.
2.assign the exact path of trash to that variable.
most likely,trash path will be /home/username/.Trash.
3.here's the code just paste this into your .bashrc file.

##################code starts here
TRASHPATH=/home/username/.Trash
function rem()
{
for i in $*
do
mv $i $TRASHPATH/$i
done
}
##################code ends here


now,if you want to delete files just issue the command
rem file1
you can give multiple files also
rem file1 file2 file3 file4 file5 etc.

p.s:instead of trash,you can direct to another folder also
don't include a slash(/) at the end of path in TRASHPATH variable
Posted in Uncategorized
Views 3119 Comments 4
« Prev     Main     Next »
Total Comments 4

Comments

  1. Old Comment
    yep, you are right, this did has a great help for recovering!!!!
    Posted 06-16-2010 at 09:00 PM by twwwater twwwater is offline
  2. Old Comment
    thank you my dear friend.
    Posted 06-17-2010 at 11:13 AM by ultimate_linux ultimate_linux is offline
  3. Old Comment
    NOTE:the path of trash can also be ~/.local/share/Trash
    Posted 06-19-2010 at 06:45 AM by ultimate_linux ultimate_linux is offline
  4. Old Comment
    There is still no sub for frequent backups and organisation.
    Posted 06-20-2010 at 07:36 PM by 2ck 2ck is offline
 

  



All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration