[Klug-general] Auto trash emptying?

Peter Childs pchilds at bcs.org
Sun Mar 3 22:43:46 UTC 2013


Check usage of find -mtime.

I dont think it does what you think it does.

Also check the file system is recording the modified time. I think this is
a mount option.  Its often switched off to speed up the file system....

I know find has 3 date options and im not sure without checking what each
one does and which ones work correctly.

Just an idea.

Peter
On 3 Mar 2013 21:58, "Sharon Kimble" <boudiccas at talktalk.net> wrote:

> 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
>
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/kent/attachments/20130303/0fc74f32/attachment.html>


More information about the Kent mailing list