deleting /tmp files from crontab

Arthur Chance freebsd at
Tue Apr 26 14:31:40 UTC 2016

On 26/04/2016 15:13, David Banning wrote:
> On Tue, Apr 26, 2016 at 02:48:51PM +0200, Michael Schuster wrote:
>> On 26/04/16 14:30, David Banning wrote:
>>> I am attempting to delete my .spamassassin files from my /tmp directory
>>> putting a command in my crontab;
>>> find /tmp/.spam*  -mmin +360 -delete
>> the find syntax looks strange (assuming this is straight 'find', not 
>> somthing crontab-specific); normally, I'd expect to see
>> # find /tmp -name '.spam*' -mmin +360 -delete
> That seems to delete the files, but not the directories starting in .spam*
> Reviewing the find man page, it appears the -delete implementation will
> not work unless the directory is empty. Still looking for solutions here.

Take a look at the -d or argument-less -depth primaries. From the man page

-depth Always true; same as the non-portable -d option.  Cause find to
       perform a depth-first traversal, i.e., directories are visited in
       post-order and all entries in a directory will be acted on before
       the directory itself.

Moore's Law of Mad Science: Every eighteen months, the minimum IQ
necessary to destroy the world drops by one point.

More information about the freebsd-questions mailing list