- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Untarring multiple specific files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 03:15 AM
02-17-2004 03:15 AM
Untarring multiple specific files
If I want to untar multiple files that have a specific extension, but at the same time not untar all files with that extension, will the following work?
1. cd dir/to/tar
2. ls -1 >> ../filename
3. vi ../filename (Once there, remove all files that are not to be unarchived.)
4. sh -c 'tar cvf /path/to/tarfile $(cat ../filelist)'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 03:20 AM
02-17-2004 03:20 AM
Re: Untarring multiple specific files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 03:21 AM
02-17-2004 03:21 AM
Re: Untarring multiple specific files
xvf is untar you would make a tar.
What you show should work to make a tar of only the files or to untar only the files assuming they were backed up the same way
tar -cvf tape /etc/profile
then
cd /etc
tar -xvf tape profile
Wont work.
Fbackup is much more flexible for this with the graph file system.
Steve STeel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 03:23 AM
02-17-2004 03:23 AM
Re: Untarring multiple specific files
You need to know the exact path to *each* file as used to tar them to do this - for EX
./path/to/file.ext
./path2/to/file2.ext
file3.ext
./path3/file4.ext
/path4/file5.ext
are all different & would need to be in "filelist" exactly as they are in the tarball whether relative as 1,2 & 4 above - or absolute as 3 & 5 above.
If they're all in the same dir, then what you propose will work - again with the caveat that the proper path be used.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 03:35 AM
02-17-2004 03:35 AM
Re: Untarring multiple specific files
if you have nothing against hard manual work, try this:
# tar -xwf
the "w" option causes an interactive tar session in which you are asked to confirm restore for each file with either a "y" or "n". Slow but safe.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 03:55 AM
02-17-2004 03:55 AM
Re: Untarring multiple specific files
tar xvfX tarfile.tar exlude-list-file
Elena.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 04:58 AM
02-17-2004 04:58 AM
Re: Untarring multiple specific files
The drawback to your method is you could exceede the maximum number of characters allowed for a command line.
Check out the "pax" command. You can supply a list of filenames to it and it can restore the selected files from your tar archive.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2004 05:21 AM
02-17-2004 05:21 AM
Re: Untarring multiple specific files
tar tvf /dev/yourdevice >>/tmp/filenames
This extracts the filenames from the tape and puts them into the text file /tmp/filenames.
Then edit the file with your favorite editor and remove any filenames you don't want. Lastly, use:
tar xvf /dev/yourdevice `cat /tmp/filenames`
This should work for any version of tar.
Chris