From owner-freebsd-questions Tue May 22 4:47: 2 2001 Delivered-To: freebsd-questions@freebsd.org Received: from anime.net (anime.net [63.172.78.150]) by hub.freebsd.org (Postfix) with ESMTP id 063BA37B424 for ; Tue, 22 May 2001 04:46:59 -0700 (PDT) (envelope-from eugene@anime.net) Received: (from eugene@localhost) by anime.net (8.9.3/8.9.3) id EAA03181 for freebsd-questions@FreeBSD.ORG; Tue, 22 May 2001 04:46:58 -0700 Date: Tue, 22 May 2001 04:46:58 -0700 From: Eugene Lee To: freebsd-questions@FreeBSD.ORG Subject: Re: script to archive old files Message-ID: <20010522044658.C2123@anime.net> Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: <03ba01c0e2ae$49847be0$cfe89298@LUCY> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <03ba01c0e2ae$49847be0$cfe89298@LUCY>; from michael@i-syt.com on Tue, May 22, 2001 at 11:59:10AM +0100 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, May 22, 2001 at 11:59:10AM +0100, Michael Bartlett wrote: : : i'm trying to figure out how to write a script that will : : - gzip all files in a directory that are older than 2 months : - email the gzip to me : - delete the files that were gzipped Disclaimer: this script is untested! --------------- chop here --------------- #!/bin/sh # whatever your starting directory is # dir=$HOME files=`find $HOME -type f -mtime +60 -print` timestamp=`date "+%Y-%m-%d"` backup=backup.$timestamp.tar.gz tar czf $backup $files # change this line if you have another email client that supports # sending emails from the command line with attachments # mutt -s "backup for $timestamp" -a $backup your@email.address < /dev/null # comment in this line when you're ready # rm -f $files $backup --------------- chop here --------------- -- Eugene Lee eugene@anime.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message