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.