recovering a single directory from a tar archive

Will Mc Donald wmcdonald at ntlworld.com
Thu Feb 19 10:43:40 UTC 2004


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/msg04040.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.





More information about the redhat-list mailing list