Date: 25 Oct 2003 10:57:04 -0400 From: Lowell Gilbert <freebsd-questions-local@be-well.ilk.org> To: freebsd-questions@freebsd.org Subject: Re: Help: tar & find Message-ID: <44wuatqsan.fsf@be-well.ilk.org> In-Reply-To: <20031025075322.GA65979@happy-idiot-talk.infracaninophile.co.uk> References: <200310250833.17091.479001601@mail.ru> <EC1E2E7A-06A8-11D8-B94B-000393801C60@g-it.ca> <20031025075322.GA65979@happy-idiot-talk.infracaninophile.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44wuatqsan.fsf>