The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
exclude a line big123456 Shell Programming and Scripting 3 04-24-2008 09:31 AM
'find' and 'tar' combination kharen11 Shell Programming and Scripting 2 02-06-2008 05:17 AM
du (exclude files) the_learner UNIX for Advanced & Expert Users 1 07-17-2007 11:06 AM
Exclude & Zip dreams5617 Shell Programming and Scripting 1 02-11-2007 05:01 PM
tar: how to exclude subdirectories? kymberm Filesystems, Disks and Memory 7 10-15-2002 12:53 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-03-2005
Registered User
 

Join Date: Sep 2004
Location: The Hague, Netherlands
Posts: 24
Getting 'tar' to exclude

I want 'tar' to exclude certain dir's.

tar cvf ............. ............ does the whole lot, but I want to exclude the 'log' dirs.
Reply With Quote
Forum Sponsor
  #2  
Old 02-03-2005
Registered User
 

Join Date: Jun 2002
Location: UK
Posts: 3
Quote:
Originally Posted by kuultak
I want 'tar' to exclude certain dir's.

tar cvf ............. ............ does the whole lot, but I want to exclude the 'log' dirs.

does this help?

tar cvf filename.tar
Create a tape (tar) archive
Description: Creates a tape (tar) archive.
* (c) Create
* (v) Verbose mode
* (f) File
* (-I include_file) - List of files to archive

Example: tar cvf htmlFiles.tar -I htmlFiles

Submitter: Robert Weeks

(Source Sun BIGAdmin)
Reply With Quote
  #3  
Old 02-03-2005
Registered User
 

Join Date: Sep 2004
Location: The Hague, Netherlands
Posts: 24
Thank you.

I back up to a hardrive which I've mounted to ./backup using 'tar cvf' and that works fine and very fast.

It's just that I run a system with a lot of extensive logfiles, which I do not need to back up. They are in the middle of things, so I want to exclude these.

It says that tar accepts exclusions, but I cannot find the right way of putting down the command.

It's Solaris 8
Reply With Quote
  #4  
Old 02-04-2005
Registered User
 

Join Date: Nov 2002
Location: Singapore
Posts: 128
tar cfX tarball.tar exclude_file -I include_file
Reply With Quote
  #5  
Old 02-05-2005
Registered User
 

Join Date: Sep 2004
Location: The Hague, Netherlands
Posts: 24
Thanks!

I now use the syntax: 'tar cvf tarball.tar include_file'

Can I use:

'tar cvf tarball.tar include_file -X exclude_file'

instead of your proposed syntax ???
Reply With Quote
  #6  
Old 02-07-2005
Registered User
 

Join Date: Nov 2002
Location: Singapore
Posts: 128
I hope so, but I dun think so
Reply With Quote
  #7  
Old 02-07-2005
bhargav's Avatar
Registered User
 

Join Date: Sep 2004
Location: USA
Posts: 511
I tried to exclude ex1.sh from tar ....
May not be viable solution.

Code:
      $chmod 400 ex1.sh
      $tar -cvf 1.tar .
      $ tar -xvf 1.tar
x .
x ./abc
x ./file1, 0 bytes, 0 media blocks.
x ./file2, 0 bytes, 0 media blocks.
x ./bcd
x ./bcd/file1, 0 bytes, 0 media blocks.
x ./hhh
x ./1.tar, 0 bytes, 0 media blocks.
tar: 0511-188 Cannot create ./ex1.sh: The file access permissions do not allow the specified action.

$chmod 755 ex1.sh
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:05 AM.


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

Content Relevant URLs by vBSEO 3.2.0