Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2012 22:27:14 +0100
From:      Steve O'Hara-Smith <ateve@sohara.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Empty logfiles
Message-ID:  <20120829222714.78ac751d.ateve@sohara.org>
In-Reply-To: <503E7495.7050306@webrz.net>
References:  <503E7495.7050306@webrz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 Aug 2012 21:59:17 +0200
Jos Chrispijn <ports@webrz.net> wrote:

> Stupic question: I have a directory with 120 logfiles (extension *.log).
> Can someone tell me how I can empty these logfiles in one command?
> I thought 'echo > *.log' would work, but no way K-)

	find . -name \*.log -exec truncate {} \;

	man find and man truncate for the gory details.

-- 
Steve O'Hara-Smith <ateve@sohara.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120829222714.78ac751d.ateve>