[Klug-general] Auto trash emptying?

Sharon Kimble boudiccas at talktalk.net
Sun Mar 3 21:58:02 UTC 2013


I'm trying to get a bash script working from a cron job that will empty
trash of all files and directories that are older than $N [7 days in
this case]. This partly works but is very inefficient in that it
doesn't delete everything that is available to be deleted, just tends
to leave stuff with no apparent reasoning. 

###########################################
#!/bin/bash
# emptyTrash.sh

DAYS=7 #       retain for N days

for SUBDIR in files info
    do
    echo Lookin\' in Trash/${SUBDIR}...
    find ${HOME}/.local/share/Trash/$SUBDIR  -mtime +${DAYS} -exec rm
-vrf {} \; done
############################################

Can anyone help me with getting a better working script please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk/taste/index.html
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
Debian Wheezy, LXDE 2, LibreOffice 4.0.0
Registered Linux user 334501 



More information about the Kent mailing list