In the end, I tried using the easy-install method, that the main site recommends. Still have errors....
I give up...
But thanks anyway.
]]>Strange... my gnome creates ".Trash-<username>" in the extrenal drives and uses them. Don't know about trash_cli and extrenal drives, but it works well with my gnome and xfce trashes.
]]>I know there's something like libtrash also.
But the problem is that I don't like the trash behaviour. I use a few external usb harddrives. When I trash a file in the external harddrive, it will move the file to my home harddrive. This is especially annoying when I trash large files. Kde also have this behaviour.
Anyways, I just wrote this script to try to emulate the gnome trash behaviour. Which is to create different trash directory on different drives. I think windows does this too.
Not sure how trash_cli will handle trash of external drives. But thank you.
]]>Limatiations/Assumptions:
1) Only for users with home folders in /home, i.e., will not work for root.
2) All external drives are mounted to /media
3) No restore function, have to manual search for files in trash folder
4) No tracking of deletion time
5) No warning if you umount drive with trash
6) Honestly, it's just to mv files to .trash.
What it does:
Moves files to $HOME/.Trash or /media/[something]/.Trash
Delete .Trash
Uses xmessage for gui
Options to delete home, media or all trash.
Copy the following to a text file named "movetotrash"
#!/bin/bash
export IFS=$'\r\n'
if [ "$#" -eq 0 ] ; then
FILELIST=`ls -A1sh ~/.Trash`
TRASHSIZE=`du -sh ~/.Trash`
MESSAGE="
HOME TRASH:
$TRASHSIZE
-----
$FILELIST
-----
"
for i in `mount |grep /media/ |awk '{print $3}'` ; do
if [ -d $i/.Trash ] ; then
FILELIST=`ls -A1sh $i/.Trash`
TRASHSIZE=`du -sh $i/.Trash`
MESSAGE="
$MESSAGE
$i:
$TRASHSIZE
-----
$FILELIST
-----
"
TRASHLIST="$TRASHLIST
$i/.Trash"
fi
done
xmessage -default no -buttons no:1,home:0,media:3,all:2 -center "
$MESSAGE
Empty Trash?
"
ACTION=$?
if [ "$ACTION" -eq "0" ] ; then
rm -rf $HOME/.Trash/*
rm -rf $HOME/.Trash/.*
xmessage -timeout 5 "Home Trash deleted"
exit
fi
if [ "$ACTION" -eq "3" ] ; then
for i in $TRASHLIST ; do
rm -rf $i
done
xmessage -timeout 5 "Media Trash deleted"
exit
fi
if [ "$ACTION" -eq "2" ] ; then
rm -rf $HOME/.Trash/*
rm -rf $HOME/.Trash/.*
for i in $TRASHLIST ; do
rm -rf $i
done
xmessage -timeout 5 "All Trash deleted"
exit
else
exit
fi
fi
for i in $@ ; do
trashdir=`echo -n "$i" | awk -F "/" '{ print "/"$2"/"$3"/.Trash/" }'`
if [ ! -d "$trashdir" ] ; then
mkdir "$trashdir" || { xmessage -timeout 5 "Error Creating Trash Directory" && exit ; }
fi
mv "$i" "$trashdir"
done
then make the file executable and copy to /usr/bin
chmod +x movetotrash
cp movetotrash /usr/bin
then create a trash.desktop file in /usr/share/applications with the following
[Desktop Entry]
Encoding=UTF-8
Exec=movetotrash %F
Icon=user-trash
Type=Application
Terminal=false
Name=Trash
GenericName=Trash
StartupNotify=false
Categories=Application
then add it as an application in lxpanel.
Or if you use rox, can use it as a appdir...
Kind of new to bash script. Actually this is a learning thing for me. Sorry for the ugly code and stuff. And urm... if it doesn't work... don't hate me.
]]>