- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to tar files in a directory exclude those in a...
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
тАО01-05-2003 06:11 PM
тАО01-05-2003 06:11 PM
I want to tar files in /opt to tape, but exlude those in /opt/test .
Thanks
Sunny
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2003 06:29 PM
тАО01-05-2003 06:29 PM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
run fbackup with -i /opt and -e /opt/test option. Do a man on fbackup and you'll see you can create a graph file and specify that graph file with -g option.
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2003 06:34 PM
тАО01-05-2003 06:34 PM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
You'll be out of luck trying to use 'tar' and excluding directories properly. You will only be able to backup the other directories using this example.
tar cv -C /opt/perf . -C /opt/dce
etc for each directory
Your best bet is to use 'fbackup', to me it a rather easy.
e.g. To backup all of /opt and exclude /opt/test
# /usr/sbin/fbackup -i /opt -e /opt/test -f /dev/rmt/0m
The man page gives some interesting infomation and examples.
HTH
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2003 06:50 PM
тАО01-05-2003 06:50 PM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
But i have to use tar. and I wish to tar
all these file under /opt, include files, directory.
Thanks
Sunny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2003 06:56 PM
тАО01-05-2003 06:56 PM
Solution1) Get gnu tar at
http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.25/
which has the exclude option
OR
2) You can capture the listing of all the directories under /opt in a file, delete "/opt/test" dir in that file and then run your tar against that file. For example ..
the file "mylist" has these entries ..
/opt/apps
/opt/OV
/opt/ansic
...
You can then run your tar like so ..
# cd /
# tar cvf /dev/rmt/0m $(cat mylist)
assuming tape device is /dev/rmt/0m.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2003 07:01 PM
тАО01-05-2003 07:01 PM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
You'll have to use GNU tar. Here's the link. This script should also help.
http://hpux.connect.org.uk/hppd/hpux/Gnu/tar-1.13.25/
=================================
#!/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
=================================
Michael
(script courtesy of Robin Wakefield)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2003 02:47 AM
тАО01-06-2003 02:47 AM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
So you generate a list of the wanted files and pipe that to "pax -w". I.e. in your case probably something like:
find /opt | grep -v '^/opt/test' | pax -w -vd
note that the "d" option, only archive directories not their contents, is needed because find(1) already lists the contents of the directories.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2003 07:58 AM
тАО01-06-2003 07:58 AM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
!#/bin/ksh
cd /opt
for FILE in `ls -1|grep -v test`
do
echo "/opt/$FILE">>/tmp/somefile
done
tar cvf /dev/tapedevice `cat /tmp/somefile`
rm /tmp/somefile
Good Luck
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2003 06:53 PM
тАО01-07-2003 06:53 PM
Re: how to tar files in a directory exclude those in a sub_dir to a tape ?
I think u can do it as following:
tar cvf tarfilename `find /opt -type f | grep -v "/opt/test/"`
Good lucky!
Tang qiang
08/01/03