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.

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.

I have some good news for you.

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

rgds
penguin

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

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.