tar -T -X

Anita Lewis ajlewis2
Mon May 17 11:28:14 PDT 2004


On Sun, 10 Mar 2002 21:32:46 +0800, Chang[linuxism] wrote:
> 
> oops.. that should be /tmp/exclude. sorry.
> I found the "*" was not needed when using -T option.
> So I didn't attempt it on the -X option. 
> 
> Lemme try... no ..didn't work... :(
> I will attach the full script
> 
> Anita Lewis wrote:
>> > Is it possible to tar backup everything in /home except
>> > /home/httpd/html/linux-sxs?
>> > tar cvzfp /home/backup/linux.backup.tgz -T /tmp/filelist -X /tmp/xclude
>> > file /tmp/filelist:
>> > /home/httpd/html/linux-sxs/
>> I'm glad you asked this, because I couldn't get it to work a while back and
>> gave up.  I tried again this morning and found that I need to do this with
>> the exclude file:
>> /home/httpd/html/linux-sxs/*
> 
I didn't try it with making a file with all those things in it.  I just made
these two files - exclude.tar and include.tar.  They look like this:

----exclude.tar
/home/ajlewis2/staroffice/*
/home/ajlewis2/MyLinuxGuide/*
/home/ajlewis2/mail/*
/home/ajlewis2/Mail*
/home/ajlewis2/readmail/*
/home/ajlewis2/yld*
/home/ajlewis2/blt*
/home/ajlewis2/.netscape*

--------include.tar
/home/ajlewis2/

------------
Then I ran:

tar cvf /home/tempbu/ajlewis2.tar -T /home/ajlewis2/include.tar -X
/home/ajlewis2/exclude.tar

To see if it would include the right thing and exclude the others.  That
worked for me.  I didn't evaluate the script, because I don't know that much
about it, but it looks like you are making a large file for the exclude that
contains all the files you want to not backup.  I did mine with just the
directory names and the asterisk as above.  Some I have several directories
with the beginning like 'blt-2000, blt-2001, blt-2002' and I just used blt*
to cover that.  It seems to work without putting the '/*' at the end.  But
with something like ~/mail/ I had to put 'mail/*' to get it to work.

Maybe someone who can read your script better than I can will give you some
advice on it.  

Anita



More information about the Linux-users mailing list