The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create an Ignite image on tape from Online IgniteUX image Andrek UNIX for Advanced & Expert Users 3 02-28-2007 04:14 PM
selective positions from a datafile ganapati Shell Programming and Scripting 10 09-19-2006 06:09 AM
Selective Umask baanprog UNIX for Advanced & Expert Users 3 08-03-2006 06:48 AM
echo is selective? rgard Shell Programming and Scripting 0 12-01-2005 01:47 PM
Using `tar` for a selective backup. Cameron Filesystems, Disks and Memory 2 07-16-2002 06:10 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-31-2002
Registered User
 

Join Date: May 2002
Location: Kent, UK
Posts: 3
Question selective tar image and dir perms

Hi,

I'm creating a tar image containing selected files held in a manifest file thus:

cat <manifest file> | xargs tar -cvpf tar.out

I need to preserve the directory as well as the file perms. When my list contains no separate directory lines, the directory is created implicitly when the first file is "untarred", but with incorrect permissions. My initial solution was to create a list entry for the directory. This preserves the dir perms, but of course grabs the entire directory contents.

Is it possible to tar up a directory entry without tar descending into it?

I'm on IRIX 6.5.6.

Thanks in advance.

Gary Farley.
Forum Sponsor
  #2  
Old 05-31-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
No you can't tar a directory and leave its contents behind.

And I have more bad news for you: that xargs thing is not going to fly. A command like:
cat filelist | xargs rm
will run the rm command once if it can fit everything on one line. But if it needs to, it will run several rm commands until it has used up the args. That's fine for rm. But tar is another matter.

If you run two tar commands like:
tar cvf xx.tar a1 a2 a3
tar cvf xx.tar bfile
you will get a tar archive with just bfile in it. The second run is overwriting the first.

Sorry for the bad news.
  #3  
Old 05-31-2002
linuxpenguin's Avatar
Registered User
 

Join Date: May 2002
Location: India
Posts: 295
I have some good news for you.

the -A option of the tar helps you to add a file to you archive.


rgds
penguin
__________________
War doesnt determine who is right, it determines who is left
  #4  
Old 06-05-2002
Registered User
 

Join Date: May 2002
Location: Kent, UK
Posts: 3
contd...

Thanks both of you for the input.

I checked the xargs point about max command line, and my backups will fit within the limit (script needs to be clearly commented though...).

So using the standard tar, it looks like I don't have many options. I started looking at GNU tar, which has a --no-recursion option and will update the thread later...
__________________
Gary Farley.
  #5  
Old 06-05-2002
Registered User
 

Join Date: May 2002
Location: Kent, UK
Posts: 3
result

Using GNU tar (1.13) solves the problem.

Simply create an additional entry in the manifest file for the directory, and use --no-recursion.

Thanks for your help.
__________________
Gary Farley.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:33 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