<p dir="ltr">Check usage of find -mtime.</p>
<p dir="ltr">I dont think it does what you think it does. </p>
<p dir="ltr">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....</p>
<p dir="ltr">I know find has 3 date options and im not sure without checking what each one does and which ones work correctly.</p>
<p dir="ltr">Just an idea. </p>
<p dir="ltr">Peter</p>
<div class="gmail_quote">On 3 Mar 2013 21:58, "Sharon Kimble" <<a href="mailto:boudiccas@talktalk.net">boudiccas@talktalk.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying to get a bash script working from a cron job that will empty<br>
trash of all files and directories that are older than $N [7 days in<br>
this case]. This partly works but is very inefficient in that it<br>
doesn't delete everything that is available to be deleted, just tends<br>
to leave stuff with no apparent reasoning.<br>
<br>
###########################################<br>
#!/bin/bash<br>
# emptyTrash.sh<br>
<br>
DAYS=7 # retain for N days<br>
<br>
for SUBDIR in files info<br>
do<br>
echo Lookin\' in Trash/${SUBDIR}...<br>
find ${HOME}/.local/share/Trash/$SUBDIR -mtime +${DAYS} -exec rm<br>
-vrf {} \; done<br>
############################################<br>
<br>
Can anyone help me with getting a better working script please?<br>
<br>
Thanks<br>
Sharon.<br>
--<br>
A taste of linux = <a href="http://www.sharons.org.uk/taste/index.html" target="_blank">http://www.sharons.org.uk/taste/index.html</a><br>
efever = <a href="http://www.efever.blogspot.com/" target="_blank">http://www.efever.blogspot.com/</a><br>
efever = <a href="http://sharon04.livejournal.com/" target="_blank">http://sharon04.livejournal.com/</a><br>
Debian Wheezy, LXDE 2, LibreOffice 4.0.0<br>
Registered Linux user 334501<br>
<br>
_______________________________________________<br>
Kent mailing list<br>
<a href="mailto:Kent@mailman.lug.org.uk">Kent@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/kent" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/kent</a><br>
</blockquote></div>