selective tar image and dir perms

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users selective tar image and dir perms
# 1  
Old 05-31-2002
Question selective tar image and dir perms


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.
# 2  
Old 05-31-2002
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 06-01-2002
I have some good news for you.

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

# 4  
Old 06-05-2002

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...
# 5  
Old 06-05-2002

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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I create a tar file for only dir and its subdir structures??

How do I create a tar file for only dir and its subdir structures?? (4 Replies)
Discussion started by: vx04
4 Replies

2. Shell Programming and Scripting

HELP! I want to locate only dir and tar.gz

I making a script to restore apache from a configuration_backup tar. For now i want at the beginning of the script that you can make a choice to choose one of the configuration_backup tars. I use this code now: `locate /restore/configuration/configuration_backup*` But if i use this i get... (1 Reply)
Discussion started by: dannyvdberg
1 Replies

3. Shell Programming and Scripting

Using find for variable combination of perms

Hi, I'm trying to use find in kshell (AIX) to find all files with perms of write for other AND any execute bit set. e.g: r--r-x-w- would qualify and rw-rw--wx would qualify but ---rwxr-xr-x wouldn't qualify So far, I've been trying something like this: find . -type f -perm... (4 Replies)
Discussion started by: alanp36
4 Replies

4. Shell Programming and Scripting

How to tar this dir excluding some files .au?

Hi all, Thanks for previous help. How to include this in script, I need to tar files which are present in /var/spool/cron/crontabs directory (used for crontab) excluding those files which are having extension .au /var/spool/cron/crontabs>>ls -ltr | grep -v .au total 438 -rw------- 1... (11 Replies)
Discussion started by: manalisharmabe
11 Replies

5. UNIX for Dummies Questions & Answers

Perms for Unix user

Can you describe how to give privileges to the user in normal use of your folder / home / user To be able to properly use Git and other applications of Python I've done something like chown-R myuser / home / myuser But there were some problems with Git commits.... like link unavailabe and... (3 Replies)
Discussion started by: sandrain
3 Replies

6. Solaris

NFS server RW perms

Hi I can't write to fs "/share/nfs" shared by nfs server despite properly setting RW permissions. NFS server is configured on CentOS and Solaris10 is client. CentOS NFS Server config : -------------------------------- Entries in /etc/exports file : # cat /etc/exports /inst ... (6 Replies)
Discussion started by: presul
6 Replies

7. Programming

Determining file access perms for current process

Stupid question, but is there an ANSI C stdlib function that will do this for me? I want to pass the function a path and determine if the current process can read/write/execute on the path. I suppose I can whip something up using fstat and then determining the current process's user/group IDs and... (6 Replies)
Discussion started by: DreamWarrior
6 Replies

8. UNIX for Dummies Questions & Answers

Tar Exclude Dir with a Specific Words

So here is what I got i have these directories names app-config app-exploded conf gen logs match src target currently i do: tar -cvf file.tar conf gen logs match src target What i want to do is: tar -cvf file.tar (exclude any dir with "app" in it) How can i... (1 Reply)
Discussion started by: rhartleyoh
1 Replies

9. UNIX for Dummies Questions & Answers

tar - Selecting target dir

Hi, 1 - How to select files to tar from a dir (indir) to the tar command? 2 - How to select the target directory where the files in a tar file should go to - I know that by default, tar remembers the path and restores files to that path. I am using HP-UX Thanks. (3 Replies)
Discussion started by: GNMIKE
3 Replies

10. Filesystems, Disks and Memory

Using `tar` for a selective backup.

Hi all & anyone. I'm trying to selectively backup up some old Apache log files before they are removed from the system (Slackware box). Have created a file listing of what I want backed up ...Below is a portion of the file ./selectedbkup... (2 Replies)
Discussion started by: Cameron
2 Replies
Login or Register to Ask a Question