1849239 Members
2713 Online
104042 Solutions
New Discussion

tar excluding dir

 
SOLVED
Go to solution
panchpan
Regular Advisor

tar excluding dir

Hello.
I use command tar -cvf for tarring a directory. Is there any way to tar excluding specific directories or files?

Thanks
4 REPLIES 4
Ralph Grothe
Honored Contributor

Re: tar excluding dir

I would assume only if you install GNU tar,
which has an --exclude option as well as -X or --exclude-from to refer to a file of excludes.
You can get GNU tar from the HP-UX porters as precompiled SD depot.
Madness, thy name is system administration
Peter Godron
Honored Contributor

Re: tar excluding dir

Hi,
Please see:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1040790
gnu tar or if you want to use fbackup, graph file

You could run a find, grep -v the enties you don't want and then use the file as input to tar. Probably quite slow, but would work.
Dennis Handly
Acclaimed Contributor
Solution

Re: tar excluding dir

>Peter: You could run a find, grep -v the enties you don't want

This won't work if that directory is a subdirectory of one you want. cpio may work better?
panchpan
Regular Advisor

Re: tar excluding dir

THANKS A LOT