Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tar exclude

Status
Not open for further replies.

ui05067

MIS
Aug 24, 2001
18
US
Want to tar up a file system "q" excluding certain directories or files ie *.idx and *.abc...........
 
tar on HP-UX is unbelievably primitive.

Luckily the more featureful /usr/bin/pax is usually also found on the system; and you can use something like this:

Code:
pax -w -s '/.*\.idx$//' -s '/.*\.abc$//' -f /path/to/q.tar q

The -s option is used to make search-and-replace modifications to filenames as they are archived; if the resulting filename is an empty string the file is not archived at all. It's a bit cumbersome but it works.

Failing that I would personally choose a combination of find and cpio. Let me know if you want details on that solution.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top