From: Wesley Darlington (wesley at domain yelsew.com)
Date: Mon 08 Oct 2001 - 14:18:32 IST
On Mon, Oct 08, 2001 at 01:33:58PM +0100, Mark Kilmartin wrote:
> Is there any way to tell tar to output say <prefix>1.tar, <prefix>2.tar
> ... prefix<n>.tar
<snip>
> But I would rather a solution which would allow me to supply the prefix
> option and tar would then go and create as many 2G files as need to
> complete the backup.
This is just a thought, but if you call gnu tar like this...
export TAPE=/tmp/thing.tar
tar cv -M -L 512 -F ./rotate.pl what-to-backup ...
./rotate.pl # Extra one necessary to rotate final file
...where /tmp/thing.tar is the base name of where you want the output to go,
512 is the size (in kB) of each part file and ./rotate.pl is a script to do
the rotating. Something like... [0]
------------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
my $filename = $ENV{TAPE};
my $i = 1;
my $worked = 0;
while (!$worked) {
my $newfilename = sprintf ("%s.%04d", $filename, $i);
++$i && next if -e $newfilename;
# <---- Race conditions `R' us
rename ($filename => $newfilename) and $worked=1;
};
------------------------------------------------------------------------
Unrotating is a different problem. :-)
Wesley.
[0] Please, I just threw this together. :-)
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:36 GMT