Unix Technical Forum

tar question

This is a discussion on tar question within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> I have the following... rgdb with... db1 db2 db3 db4 db5 Within the rgdb directory. I want to tar ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2008, 06:06 AM
LHradowy
 
Posts: n/a
Default tar question

I have the following...
rgdb
with...
db1
db2
db3
db4
db5
Within the rgdb directory.
I want to tar all that is under the rgdb directory (recursive) but not the
db5 directory. This is where I want to put the tar file.
I want to run this from a script.

I did not see any examples in the man pages. And I cant seem to get an
handle around this one...
Any help..



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-12-2008, 06:06 AM
Hubert Feyrer
 
Posts: n/a
Default Re: tar question

In comp.unix.misc LHradowy <laura.hradowy@nospam.mts.ca> wrote:
> I have the following...
> rgdb
> with...
> db1
> db2
> db3
> db4
> db5
> Within the rgdb directory.
> I want to tar all that is under the rgdb directory (recursive) but not the
> db5 directory. This is where I want to put the tar file.
> I want to run this from a script.
>
> I did not see any examples in the man pages. And I cant seem to get an
> handle around this one...


Well, just use some basic Unix shell lines:
tar cf rgdb/db5/bla.tar `ls -d rgdb/*/. | grep -v rgdb/db5/`
.... or so.


- Hubert

--
Want to get a clue on IPv6 but don't know where to start? Try this:
* Basics -> http://www.onlamp.com/pub/a/onlamp/2..._tutorial.html
* Setup -> http://www.onlamp.com/pub/a/onlamp/2..._tutorial.html
Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-12-2008, 06:06 AM
Fletcher Glenn
 
Posts: n/a
Default Re: tar question

LHradowy wrote:
>
> I have the following...
> rgdb
> with...
> db1
> db2
> db3
> db4
> db5
> Within the rgdb directory.
> I want to tar all that is under the rgdb directory (recursive) but not the
> db5 directory. This is where I want to put the tar file.
> I want to run this from a script.
>
> I did not see any examples in the man pages. And I cant seem to get an
> handle around this one...
> Any help..


tar cvf repository ./rgdb/db1 ./rgdb/db2 ./rgdb/db3 ./rgdb/db4

--
Fletcher Glenn
email f-g-l-e-n-n@quest.com (remove the dashes)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-12-2008, 06:06 AM
Joerg Schilling
 
Posts: n/a
Default Re: tar question

In article <AFmOa.6378$V8.3982@news1.mts.net>,
LHradowy <laura.hradowy@NOSPAM.mts.ca> wrote:
>I have the following...
>rgdb
>with...
>db1
>db2
>db3
>db4
>db5
>Within the rgdb directory.
>I want to tar all that is under the rgdb directory (recursive) but not the
>db5 directory. This is where I want to put the tar file.
>I want to run this from a script.


star -c -V pat=db5* -C rgdb . > /tmp/somfile.tar

ftp://ftp.berlios.de/pub/star

http://www.blastwave.org/packages.php

--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni) If you don't have iso-8859-1
schilling@fokus.fraunhofer.de (work) chars I am J"org Schilling
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-12-2008, 06:06 AM
Joerg Schilling
 
Posts: n/a
Default Re: tar question

In article <becvv4$3nlsq$1@ID-180809.news.dfncis.de>,
Hubert Feyrer <hubert@feyrer.de> wrote:
>In comp.unix.misc LHradowy <laura.hradowy@nospam.mts.ca> wrote:
>> I have the following...
>> rgdb
>> with...
>> db1
>> db2
>> db3
>> db4
>> db5
>> Within the rgdb directory.
>> I want to tar all that is under the rgdb directory (recursive) but not the
>> db5 directory. This is where I want to put the tar file.
>> I want to run this from a script.
>>
>> I did not see any examples in the man pages. And I cant seem to get an
>> handle around this one...

>
>Well, just use some basic Unix shell lines:
>tar cf rgdb/db5/bla.tar `ls -d rgdb/*/. | grep -v rgdb/db5/`
>... or so.


Sounds prone to problems.....

If the only reason for excluding the directory db5, is to avoid that the
tar archive becomes part of itself, just use star. Star will detect the
archive and auto-exclude it from the list of files that go into the archive:

star -c f=db5/xx.tar .

ftp://ftp.berlios.de/pub/star

http://www.blastwave.org/packages.php

--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni) If you don't have iso-8859-1
schilling@fokus.fraunhofer.de (work) chars I am J"org Schilling
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-12-2008, 06:06 AM
Vincent Smeets
 
Posts: n/a
Default Re: tar question

Hallo,

I would use the fillowing commands:

$ echo rgdb/db5 >/tmp/exclude.$$
$ tar cXf /tmp/exclude.$$ rgdb/db5/dump.tar rgdb
$ rm -f /tmp/exclude.$$

With the X parameter, you can define a file containing all the names of
files and directories that have to be excluded from the tar file (see the
manual pages).

Vincent


"LHradowy" <laura.hradowy@NOSPAM.mts.ca> wrote in message
news:AFmOa.6378$V8.3982@news1.mts.net...
> I have the following...
> rgdb
> with...
> db1
> db2
> db3
> db4
> db5
> Within the rgdb directory.
> I want to tar all that is under the rgdb directory (recursive) but not the
> db5 directory. This is where I want to put the tar file.
> I want to run this from a script.
>
> I did not see any examples in the man pages. And I cant seem to get an
> handle around this one...
> Any help..
>
>
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-12-2008, 06:06 AM
LHradowy
 
Posts: n/a
Default Re: tar question


> I have the following...
> rgdb
> with...
> db1
> db2
> db3
> db4
> db5
> Within the rgdb directory.
> I want to tar all that is under the rgdb directory (recursive) but not the
> db5 directory. This is where I want to put the tar file.
> I want to run this from a script.
>
> I did not see any examples in the man pages. And I cant seem to get an
> handle around this one...
> Any help..


How would I compress it at the same time, when I try to do a tar zcvf, it
does not recognize the -z option...


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-12-2008, 06:07 AM
Joerg Schilling
 
Posts: n/a
Default Re: tar question

In article <LzBOa.8114$V8.5450@news1.mts.net>,
LHradowy <laura.hradowy@NOSPAM.mts.ca> wrote:

>How would I compress it at the same time, when I try to do a tar zcvf, it
>does not recognize the -z option...


The -z option is only recognised by GNU tar or star

ftp://ftp.berlios.de/pub/star
http://www.blastwave.org/packages.php


--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
js@cs.tu-berlin.de (uni) If you don't have iso-8859-1
schilling@fokus.fraunhofer.de (work) chars I am J"org Schilling
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-12-2008, 06:07 AM
Barry Margolin
 
Posts: n/a
Default Re: tar question

In article <AFmOa.6378$V8.3982@news1.mts.net>,
LHradowy <laura.hradowy@NOSPAM.mts.ca> wrote:
>I have the following...
>rgdb
>with...
>db1
>db2
>db3
>db4
>db5
>Within the rgdb directory.
>I want to tar all that is under the rgdb directory (recursive) but not the
>db5 directory. This is where I want to put the tar file.
>I want to run this from a script.


tar cf db5/file.tar db1 db2 db3 db4

--
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:08 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com