The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-16-2006
piooooter piooooter is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 24
Exclamation Need help with tar

Hello

I need help with tar. I want to create a tar archive and compress it at one operation. I want also to exclude some subdirectories from a directory which is archived.

For example I need to archive the /aaa/bbb/ccc directory and create the ccc.tar.gz file. But I don't want the /aaa/bbb/ccc/ddd directory to be archived. Is it possible to that all issues at once in one command?

Regards,
Pit
  #2 (permalink)  
Old 05-16-2006
azrealhk azrealhk is offline
Registered User
  
 

Join Date: Jul 2002
Location: HK
Posts: 20
You can probably chain a list of commands together.

If you know which files and directories to tar, it will be much easier.

On solaris
you can tar and compress using

cd /aaa/bbb; tar cvf - ./<ccc> | gzip - ccc.tar.gz

use -X to exclude directories, and -l for file list, whatever is more convenient for you.

on AIX replace gzip with compress (you will get a .Z file instead)

on AIX you only have -L to include the file list.

Obviously if you have a file list and know which directories to exclude you can type them in before hand and have a short one-liner.

Otherwise you may need a loop using ls and check for a directory and >> to the exclude file before you perform your tar.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

BB 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 -4. The time now is 05:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0