The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Q: tar archive help nookie UNIX for Dummies Questions & Answers 1 09-03-2007 07:30 AM
Updating a File in a Zip Archive dbridle AIX 6 09-27-2006 12:29 PM
Archive script old files kayarsenal Shell Programming and Scripting 1 08-24-2006 10:46 PM
Archive files kayarsenal Shell Programming and Scripting 13 08-21-2006 08:01 AM
tar archive with .Z files Kun2112 UNIX for Dummies Questions & Answers 3 08-05-2005 06:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-18-2006
Registered User
 

Join Date: Jul 2004
Location: USA
Posts: 52
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Arrow Archive (tar)

Hi,

I want to archive below directories
ex: /home/oracle/ddd0
/home/oracle/ddd1
/home/oracle/ddd2

I want a command(tar) which will let me archive the above directories excluding *.dmp(dump files), *.log(log files) in those directories.

So the archived file doesn't have *.dmp(dump files), *.log(log files) in it.

thanks
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-19-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Helo.
Depending on your tar version, there's an option which allows you that. For instance, Solaris 9 tar man page says:
Code:
 X     Exclude. Use the exclude-file argument as a file  con-
           taining  a  list  of relative path names for files (or
           directories) to be  excluded  from  the  tarfile  when
           using the functions c, x, or t. Be careful of trailing
           white spaces. Also beware  of  leading  white  spaces,
           since,  for each line in the excluded file, the entire
           line (apart from the newline) will be  used  to  match
           against the initial string of files to exclude. Multi-
           ple X arguments may be used, with one exclude-file per
           argument.  In  the  case  where included files (see -I
           include-file option) are also specified, the  excluded
           files  take  precedence  over all included files. If a
           file is specified in both  the  exclude-file  and  the
           include-file  (or  on  the  command  line), it will be
           excluded.
Anyway, you could do something like:
Code:
touch /tmp/bck.tar && find /home/oracle/ddd[12] ! -name "*log" ! -name "*dmp" -type f -exec tar uvf /tmp/bck.tar {} \;

Regards.
Reply With Quote
  #3 (permalink)  
Old 10-19-2006
Registered User
 

Join Date: Jul 2004
Location: USA
Posts: 52
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Exclamation Archive (tar)

Hi,

I want to archive below directory
ex: /home/oracle/dd0
sub-directories in dd0
/home/oracle/dd0/backup/backup1
/home/oracle/dd0/backup/backup2
/home/oracle/dd0/dmp
....etc

I want a command(tar) which will let me archive the above directory excluding *.dmp(dump files), *.log(log files) in that directory & in the sub-directories also.

So the archived file doesn't have *.dmp(dump files), *.log(log files) in it.

Pls reply ASAP.

The below reply for this post ignores the sub-directories.

thanks
Reply With Quote
  #4 (permalink)  
Old 10-19-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Have you tried the "X" tar option? Read your tar man page for more info...
Reply With Quote
  #5 (permalink)  
Old 03-29-2007
Registered User
 

Join Date: Mar 2007
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Hey Tell me how can we use Tar's "X" i.e. exclude option give me a example of command which can runs on SunOS and /bin/sh shell.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
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



All times are GMT -7. The time now is 09:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102