deleting /tmp files from crontab

Timo Buhrmester fstd.lkml at gmail.com
Tue Apr 26 14:30:04 UTC 2016


> > # 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.
A common idiom is ``find ... -print0 | xargs -0 rm -r''.
Note that -print0 and xargs -0 aren't POSIX, but I'm not aware of
implementations lacking those.


More information about the freebsd-questions mailing list