From owner-freebsd-questions@FreeBSD.ORG Sat Oct 25 07:57:05 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E36AC16A4B3 for ; Sat, 25 Oct 2003 07:57:05 -0700 (PDT) Received: from be-well.ilk.org (lowellg.ne.client2.attbi.com [66.30.200.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4265A43FAF for ; Sat, 25 Oct 2003 07:57:05 -0700 (PDT) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: by be-well.ilk.org (Postfix, from userid 1147) id B55773B05; Sat, 25 Oct 2003 10:57:04 -0400 (EDT) Sender: lowell@be-well.ilk.org To: freebsd-questions@freebsd.org References: <200310250833.17091.479001601@mail.ru> <20031025075322.GA65979@happy-idiot-talk.infracaninophile.co.uk> From: Lowell Gilbert Date: 25 Oct 2003 10:57:04 -0400 In-Reply-To: <20031025075322.GA65979@happy-idiot-talk.infracaninophile.co.uk> Message-ID: <44wuatqsan.fsf@be-well.ilk.org> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: Help: tar & find X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2003 14:57:06 -0000 > > Thanks for the response, but what would be a better solution? > > There are several possibilities, all of which equate to passing the > list of files to backup to the tar command (or equivalent) via stdin > rather than the command line. Perhaps the simplest is to use the '-I' > or '-T' flag to tar(1): > > find $FILES_DIR -xdev -type f -iname '*.bak' -print0 | \ > tar --remove-files --null -T - \ > -cvzpf $TAR_DIR/bak_files_`date +%F`.tar.gz > > Other possibilities would include using cpio(1), which can be > persuaded to emit tar format archives, or to build a perl backup > script based around the File::Find and Archive::Tar modules. Or passing the date in an environment variable. I think something like datestamp=`date +%F` find $FILES_DIR -xdev -type f -iname '*.bak' -print0 | \ tar --remove-files --null -T - \ -cvzpf $TAR_DIR/bak_files_${datestamp}.tar.gz should work.