This discussion is archived
1 Reply Latest reply: Nov 28, 2012 1:36 PM by bobthesungeek76036 RSS

untar a .tar file and exclude one directory

976812 Newbie
Currently Being Moderated
How's it going?

I have a tar file and I want to exclude a directory when I untar it but when I use the --exclude option the only thing that gets untarred is the directory I don't want.

I'm sure I'm doing the command incorrectly so any help is appreciated. I'm an AIX guy and new to Solaris so take it easy on me :)

Thanks in advance.
  • 1. Re: untar a .tar file and exclude one directory
    bobthesungeek76036 Pro
    Currently Being Moderated
    Are you using the Solaris tar or GNU tar? The former does not support the --exclude so that may be part of the problem.  And when you are excluding paths, the paths have to match exactly as the files are written from the root of the tar archive.  If you want to exclude a directory "home" and it was written to the file as ./home, you must use ./home as the exclude string.  "home" and "/home" won't work...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points