Create a file excludes.txt or name it anything as you wish.
Write the name of file or directory into the file excludes.txt which you want to exclude
cat excludes.txt
XYZ/abc
tar -Xcvf ./excludes.txt XYZ.tar XYZ
The above command will exclude the abc directory(or file) inside the XYZ directory.
If you want to exclude more directories (or files) , add their names to excludes.txt separated by lines.
The above procedure is tested on Solaris.
Write the name of file or directory into the file excludes.txt which you want to exclude
cat excludes.txt
XYZ/abc
tar -Xcvf ./excludes.txt XYZ.tar XYZ
The above command will exclude the abc directory(or file) inside the XYZ directory.
If you want to exclude more directories (or files) , add their names to excludes.txt separated by lines.
The above procedure is tested on Solaris.