- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- tar: excluding files from an archive
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
Discussions
Discussions
Discussions
Forums
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
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-21-2002 01:33 AM
тАО02-21-2002 01:33 AM
tar: excluding files from an archive
On the version of HP-UX that I am using (B.11.00 U 9000/800 ) there is no X option
I need to be able to create different archives from the same root, but to exclude different parts for different builds.
Does anyone know how to do this on HP-UX
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 01:39 AM
тАО02-21-2002 01:39 AM
Re: tar: excluding files from an archive
Unless you install GNU tar, I think you have to workaround this by using a script eg.
#!/sbin/sh
list=""
for i in `find $1 -print`
do
if grep "^$i " /etc/tar.exclude >/dev/null 2>&1
then
:
else
list="$list $i"
fi
done
tar cvf /dev/rmt/0m $list
#end of script
/etc/tar.exclude includes all the files that are to be excluded.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 01:58 AM
тАО02-21-2002 01:58 AM
Re: tar: excluding files from an archive
A one-time job, and it will make things easier in the long run. Your tar command will simply be:
tar cvf mytar `cat tar.include`

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 02:16 AM
тАО02-21-2002 02:16 AM
Re: tar: excluding files from an archive
tar -cvf tarfile `find . -print | egrep -vx 'file1|file2|..|fileX'
or even better the GNU's tar from the site:
http://hpux.connect.org.uk/hppd/hpux/Gnu/tar-1.13.25/
Ciao
Federico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 03:33 AM
тАО02-21-2002 03:33 AM
Re: tar: excluding files from an archive
try something like this :
find . -depth -print | cpio -oB -f /unwantedfile > /dev/rmt/0m
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 07:32 AM
тАО02-21-2002 07:32 AM
Re: tar: excluding files from an archive
Thanks for your help so far, but all of the suggestions fail in one way or another:
a) the 'do' loop fails because while it excludes the dir
/path/to/unwanted_file
it does not exclude
/path/to/unwanted_file/file
b) use of egrep fails because it excludes names like the unwanted file, so if the dir structure contains
/path/to/unwanted_file/file
/path/to/unwanted_file_needed/file
then both are are excluded, whereas the second of the above needs to be retained
c) the version of HP-UX that I have does not appear to support cpio -o -f
Any other ideas would be very welcome
Thanks,
Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 07:35 AM
тАО02-21-2002 07:35 AM
Re: tar: excluding files from an archive
As Federico stated (above), gnu's tar, which HP has ported, will do just what you want, plus it handles 2GB+ files, compression, and can do remote tapedrive writing!
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 07:36 AM
тАО02-21-2002 07:36 AM
Re: tar: excluding files from an archive
The standard tar that comes with hp-ux has no option to exclude files from the archive which extrcting data. I think GNUtar has some support like that.
Hope this helps.
regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 07:39 AM
тАО02-21-2002 07:39 AM
Re: tar: excluding files from an archive
change the 'grep "^$i " [file]' to be 'grep "^${i}$" [file] to set grep for complete line, (replace space with $)
then create a second 'if' and 'grep' statement checking 'grep "^$i/" [file] (force subdirectories).
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 07:42 AM
тАО02-21-2002 07:42 AM
Re: tar: excluding files from an archive
-c - Matches all file or archive members except those specified by the pattern or file arguments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 07:43 AM
тАО02-21-2002 07:43 AM
Re: tar: excluding files from an archive
Try this version:
=================================
#!/sbin/sh
list=""
for i in `find $1 -type f`
do
grep -q "^${i}$" /etc/tar.exclude || list="$list $i"
done
echo tar cvf /dev/rmt/0m $list
=================================
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 08:18 AM
тАО02-21-2002 08:18 AM
Re: tar: excluding files from an archive
try this:
find . -print | grep -v -E -f ./excludelist | grep -v "^\.$"| pax -w > /backuppath
pax , by default, writes archives in the ustar extended tar interchange format. (do a man pax)
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2002 11:44 PM
тАО02-21-2002 11:44 PM
Re: tar: excluding files from an archive
A big thankyou to all who replied
- problem now sorted
Thanks,
Geoff