Re: tar question
On Sun, Jan 06, 2002 at 02:08:35PM -0500, dman wrote:
> On Sun, Jan 06, 2002 at 12:26:58PM -0500, Stan Brown wrote:
> | How can I get tar to backup my entire machine to a file in /tmp with
> | causing recursion?
>
> tar -zcvf /tmp/backup.tar.gz /[^t]*
>
> tar acts recursively automatically, but it is bad to try and include
> the directory you are writing the tar file to (it tries to include it,
> and it bombs out).
Not sure what you mean with bombs out. For me it works, tar is clever enough
to excluding such a recursive file but behaves correctly otherwise, like:
$ mkdir foo
$ touch foo/a
$ tar -cf foo/foo.tar foo
tar: foo/foo.tar: file is the archive; not dumped
$ ls foo/
a foo.tar
$ tar -tf foo/foo.tar
foo/
foo/a
See, foo.tar is created and has the correct content, i.e. no foo/foo.tar
but all other files are put into the tar archive.
$ tar -cf foo/foo.tar foo
tar: foo/foo.tar: file is the archive; not dumped
$ tar -tf foo/foo.tar
foo/
foo/a
And even doint it again, now with foo/foo.tar existing, still works as
it should work: foo/foo.tar itself is excluded but all other things get
into the tar file.
--
groetjes, carel
Reply to: