Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 May 1998 11:46:30 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Andrew Specht <andrew@iaccess.com.au>, freebsd-questions@FreeBSD.ORG
Subject:   Re: gzip and date???
Message-ID:  <19980511114630.R7546@freebie.lemis.com>
In-Reply-To: <02a601bd7c7f$42908420$e34a05cb@alpine.iaccess>; from Andrew Specht on Mon, May 11, 1998 at 11:50:48AM %2B1000
References:  <02a601bd7c7f$42908420$e34a05cb@alpine.iaccess>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 11 May 1998 at 11:50:48 +1000, Andrew Specht wrote:
> hey,
>
> Would anyone know how to make gzip include the date in the zipped file?
>
> eg:
>
> cache.log  >> cache.log.gz.050598
>
> does that work?  nothing in the man pages about it.

gzip doesn't do this.  It also doesn't normally recognize this kind of
name as a gzip archive.  There's nothing to stop you writing a
wrapper, though, like:

#!/bin/sh
for i in $*; do
  gzip $i
  mv $i.gz $i.`date "+%d%m%y"`.gz
done

This will rename the file in your example to cache.log.050598.gz.

Greg
--
See complete headers for address and phone numbers
finger grog@lemis.com for PGP public key

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



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