-X ExcludeList
Excludes the file names or directories given in the ExcludeList from the tar archive being created, extracted or listed. The ExcludeList shall contain only one
filename or directory per line which are to be excluded from the tar archive being created, extracted from or listed. The -X option can be specified multiple
times and it takes precedence over all other options.
Another way, having 3 directories a b and c where all 3 contain files but you dont want to have dir b in the archive file:
$ tar cvf my.tar $( find . -type d -name b -prune -o -print| grep -v ^\.$ )
a ./a
a ./a/one 0 blocks.
a ./a/one 0 blocks.
a ./c
a ./c/two 0 blocks.
a ./c/two 0 blocks.
$ tar tvf my.tar
drwxr-xr-x root root 0 Sep 11 12:43:19 2013 ./a/
-rw-r--r-- root root 0 Sep 11 12:43:19 2013 ./a/one
-rw-r--r-- root root 0 Sep 11 12:43:19 2013 ./a/one
drwxr-xr-x root root 0 Sep 11 12:43:54 2013 ./c/
-rw-r--r-- root root 0 Sep 11 12:43:54 2013 ./c/two
-rw-r--r-- root root 0 Sep 11 12:43:54 2013 ./c/two
You are right.
But this option is not included in AIX 5.2
I'm searching in man page of tar, I didn't find any talking about excluding files or directories!
It's man page have -x but it is doing another task.