On Wed, Apr 12, 2006 at 06:19:21PM +1000, Jamie Wilkinson wrote:
> This one time, at band camp, Terry Collins wrote:
> >Can anyone tell me what is the correct form of
> >
> >find smtpd* -atime 7 -exec ` rm -f {} ` \;
> >on a RH5.2 system?
>
> You can only specify one directory to look in, so smtpd* isn't going to
> work.
not true -- do as many as you like
> find . -wholename './smtpd*' -atime 7 -exec rm -f {} \;
>
> or
>
> find . -wholename './smtpd*' -atime 7 -print0 | xargs -0 rm -f
>
> I only just learnt -wholename so I may have gotten the syntax wrong. Buyer
> beware! :-)
I suspect older find's don't have -wholename.
Here's my literal translation (the backquotes should definitely not be there)
find smtpd* -atime 7 -exec rm -f {} \;
It'll only work of course if you're in the parent dir
of smptd*. Meaning the ./ bit is redundant.
Using -atime is a bit odd; you usually want -mtime.
atime can be updated every backup, i.e. every night!.
Also rm is only good for files, not dirs.
And add the usual -0 and xargs goodness and you get:
find smtpd* -type f -mtime 7 -print0 | xargs -0 rm -f
Matt
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html