Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tar help... 1

Status
Not open for further replies.
Oct 22, 2001
215
0
0
US
Hi,
I got 2 dir (test1 and test2) that I want compress with 'tar' except 1 file (logon) in test2.

I am trying the following but don't know what am I doing wrong..... it is saying logon file excluded but, there is nothing on the test.tar that I am creating!
#######################################
tar -cvfX test.tar test1 test2 logon
#######################################
TIA


 
The -X option specifies a file containing a list of files to exclude. If your version of tar supports it, the --exclude option can be given like this:

tar --exclude logon -cvf test.tar test1 test2

If you don't have the --exclude option, you can do the following:

echo "logon" > filestoskip
tar -X filestoskip -cvf test.tar test1 test2
 
This is how it works on my Solaris machine:

tar -cvfX some.tar loose *.c
where 'loose' is a file containing excluded files so:

List directory
$ls
a.c
b.c
union.c
x_string.c

Cat loose file
%cat loose
union.c

Tar the c files
%tar -cvfX some.tar loose *.c
a a.c 1K
a b.c 1K
a union.c excluded
a x_string.c 2K

List the tar
%tar -tf some.tar
a.c
b.c
x_string.c

---

From what I have used of X option ... the lines in the loose file must match exactly with the excluded file (path and name from where the tar command is run).

so if logon is off the test1 directory ... this is what needs to be in the loose file if your running tar in test1's parent directory:

test1/logon

Hopefully this helps a little. I could be wrong, I very rarely use other options on tar except cvfx.

;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top