Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2008 11:54:38 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        Joe Tseng <joe_tseng@hotmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: gzipping multiple files w/o tarring
Message-ID:  <20081010185438.GA40860@icarus.home.lan>
In-Reply-To: <BAY117-W12F038ED445086170210BE9B350@phx.gbl>
References:  <BAY117-W12F038ED445086170210BE9B350@phx.gbl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 10, 2008 at 02:49:44PM -0400, Joe Tseng wrote:
> 
> I'm sure this is easy but googling hasn't gotten me anywhere yet...  I want to compress all the files in my directory that don't already have a .gz extension.  I want them to be individual compressed files, not part of a single .tar.gz file.  Can anyone point me to where I can find how to do this?

"gzip *" will do what you want.

When it encounters something that's already gzip'd, it will skip it,
but will emit a warning that it's doing so.

Otherwise, you could use something like:

find -X . \! -name "*.tar.gz" -type f -maxdepth 1 | xargs gzip

Which would do the same as "gzip *", but would ignore any files
with a .tar.gz extension.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




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