[EMAIL PROTECTED]:~$ cat .kde/shutdown/TrashReaper
#!/bin/bash

#Removes old files from the KDE trash folder (KDE >= 3.4)
#(c) 2005 Bram Schoenmakers


# http://bram85.blogspot.com/2005/11/only-good-for-trash-bin.html

EXPIREDATE=`date -d'30 days ago' +%Y%m%d`
TRASHDIR=~/.local/share/Trash


cd $TRASHDIR/info

for ITEM in *.trashinfo; do
  ITEMNAME=`echo "$ITEM" | sed -e 's/.trashinfo//'`

  #extract date
  TRASHDATE=`grep DeletionDate "$ITEM" | sed -e 
's/^.*\(....\)-\(..\)-\(..\)T.*$/\1\2\3/'`


  if [ $TRASHDATE -le $EXPIREDATE ]; then
    rm -rf "$TRASHDIR/files/$ITEMNAME"
    rm -f "$TRASHDIR/info/$ITEM"
    #echo "$TRASHDIR/files/$ITEMNAME"
    #echo "$TRASHDIR/info/$ITEM"
  fi
done
[EMAIL PROTECTED]:~$ crontab -l
# m h  dom mon dow   command
@daily  ~/.kde/shutdown/TrashReaper

With this script in ~/.kde/shutdown and a cronjob to run daily, Trash
auto-delete can be accomplished.

-- 
add an option to autodelete items from trash:/ after a specified span of time
https://bugs.launchpad.net/bugs/228369
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to nautilus in ubuntu.

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to