Empty logfiles

Steve O'Hara-Smith ateve at sohara.org
Wed Aug 29 21:27:24 UTC 2012

On Wed, 29 Aug 2012 21:59:17 +0200
Jos Chrispijn <ports at 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 at sohara.org>

More information about the freebsd-questions mailing list