Excluding file from tar

Hello i am using HP-UX rapdb2 B.11.23 U ia64 1068321383 unlimited-user license.

I am tryiyng to exclude for tar all files that start with TOT* but i doues not work

I am using:

tar -cvf /ODS/prepaid/CDR_FLOW/WORK/backup.tar --exclude='TOT*'

and i get the error:

tar: cannot stat --exclude=TOT*.  Not dumped.

Any idea?

Best regards,
Christos

find . -name 'TOT*'  > exclude.file
tar cvfX [name of tar file] exclude.file   .

. == current directory and subdirectories

I still het the error:
X: unknown option

To Moderator: Can you please provide instructions regarding code tags?
Answer:
[ c o d e ]
your code goes here
[ / c o d e ]

Remove spaces and you have code tags

I don't think that there is a "-X" switch to HP-UX "tar".

We could try the "pax" command (which defaults to tar interchange format, but do read the manual and test-read your archive afterwards with "tar" (or "pax") on the target system

find . -type f ! -name TOT\* | pax -v -w -f /ODS/prepaid/CDR_FLOW/WORK/backup.tar 

If you have subdirectories, lose the "-type f" as long as you don't have a directory with a name starting with "TOT".

find . ! -name TOT\* | pax -v -w -f /ODS/prepaid/CDR_FLOW/WORK/backup.tar