alternative to rm command
Posted 06-16-2010 at 09:00 AM by ultimate_linux
Tags recovery data, rm command
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
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
Total Comments 4
Comments
-
yep, you are right, this did has a great help for recovering!!!!
Posted 06-16-2010 at 09:00 PM by twwwater -
thank you my dear friend.
Posted 06-17-2010 at 11:13 AM by ultimate_linux -
NOTE:the path of trash can also be ~/.local/share/Trash
Posted 06-19-2010 at 06:45 AM by ultimate_linux -
There is still no sub for frequent backups and organisation.
Posted 06-20-2010 at 07:36 PM by 2ck