[TriLUG] `find -delete` not deleting

Aaron Morrison via TriLUG trilug at trilug.org
Tue Sep 6 14:15:53 EDT 2016


> On Sep 6, 2016, at 13:03, Steve Litt via TriLUG <trilug at trilug.org> wrote:
> 
> 
> 
> Why are you using find? Your directories are already named for
> datestamps. Just have the cron job's shellscript calculate 7 days
> ago (let's say 8/27/2016), then do rm -rf whatever/20160827.
> 
> SteveT
> 

So what if cron misses its trigger?  E.g. On a laptop that is off or sleeping? If so then this will miss removing that week old directory and no subsequent cron execution will remove it either. (I'll grant that some cron implementations try to recognize missed triggers and those may work)

The find method will recover from that case and in fact may be more flexible if the conditions change. ( only want to remove symlinks? No problem.  )

--am

> Steve Litt 
> September 2016 featured book: Twenty Eight Tales of Troubleshooting
> http://www.troubleshooters.com/28
> 
> 
> -- 



More information about the TriLUG mailing list