Date: Tue, 22 May 2001 04:46:58 -0700 From: Eugene Lee <eugene@anime.net> To: freebsd-questions@FreeBSD.ORG Subject: Re: script to archive old files Message-ID: <20010522044658.C2123@anime.net> In-Reply-To: <03ba01c0e2ae$49847be0$cfe89298@LUCY>; from michael@i-syt.com on Tue, May 22, 2001 at 11:59:10AM %2B0100 References: <03ba01c0e2ae$49847be0$cfe89298@LUCY>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010522044658.C2123>