recovering a single directory from a tar archive

Marvin Blackburn mblackburn at glenraven.com
Thu Feb 19 10:56:36 UTC 2004


Thanks, that was a big help.
I had read in Unix Power Tools that you had to specify a file.  If you
specified a directory nothing would be extracted.

------------------
Marvin Blackburn
Systems Administrator
Glen Raven
"He's no failure.  He's not dead yet" --William Lloyd George

> -----Original Message-----
> From: redhat-list-admin at redhat.com
> [mailto:redhat-list-admin at redhat.com]On Behalf Of Will Mc Donald
> Sent: Thursday, February 19, 2004 10:44 AM
> To: redhat-list at redhat.com
> Subject: Re: recovering a single directory from a tar archive
>
>
> From: "Marvin Blackburn" <mblackburn at glenraven.com>
> > I have a single rhel 2.1 es systems that has an attached tape drive.
> > I need a good way to back it up, and I was thinking tar would work.
> > However, I often have to recover directories and there are
> too many files to
> > list individually.
> > Is there an easy way to get a particular directory.
> >
> > Or is there another mechanism for backing up that would
> alleviate this
> > problem.  I have considered amanda; however it seems to be
> a bit of overkill
> > just for one system.
>
> http://lists.debian.org/debian-user/2001/debian-user-200101/ms
g04040.html

Assuming $archive is your tarfile or tape device and $filename is the file
you want you can just do...

$ tar tvf $archive

... for a file listing. Then to extract one file just do...

$ tar xvf $archive $filename

Add the 'z' option as required if your archive's compressed. Your other
alternative would be to use dump/restore. Then do a...

$ restore -ivf

And you could 'cd' down into the appropriate place, 'add' the required files
the 'extract'.

Will.


--
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list





More information about the redhat-list mailing list