tar -C syntax question

I am writing a perl script to tar multiple files (in unix) from a given directory to a given output directory. I do NOT want the file path included in the tar, so I've flagged the -C option. Example:

tar -cvf tar/1.tar -C htmp/source/ 1-1-1.xml

However, I need to do this for a number of target files from the same directory. I've found that if I just specify another -C flag I can do a second file, like:

tar -cvf tar/1.tar -C htmp/source/ 1-1-1.xml -C htmp/source/ 1-1-19.xml

but this seems way too long, considering the number of files in the given directory. I'm wondering if anyone knows of a syntax shortcut to get all the files in this directory, without having to flag -C for each one.

Thanks

---------- Post updated at 12:27 PM ---------- Previous update was at 12:17 PM ----------

Heh... nvm I found the answer. Just looked at man tar:
"If file is `.', archive all files in directory."
RTFM, I guess.

so,

tar -cvf tar/1.tar -C htmp/source/ .

grabs everything.

Cheers

Just one -C ought to do.

The second -C probably isn't doing anything since these are relative paths -- it moves from ./ into ./html/source the first time, tries to chdir into ./htmp/source/htmp/source/ and complain no such directory, and still adds 1-1-19.xml because it's dir didnt' change since the first -C.

that's what i thought at first, too, but that wasn't working either:

> tar -cvf tar/1.tar -C hmtp/source/ 1-1-1.xml 1-1-19.xml
a 1-1-1.xml 6K
tar: 1-1-19.xml: No such file or directory

I figured it out though, see my update.

If you really want to archive the whole folder, just tar -cf file.tar /path/to/folder/, no -C necessary. I was assuming you just wanted all xml files in the folder or something.

The -C difference is interesting. My version of tar stays chdir-ed after -C.