tar syntax problem -C

I tried this command from the directory "/usr/data/usr/target":
Code:
# tar -cf /tmp/filename.tar -C /usr/data *.dbf *.prg

I get a series of error messages of the form:
Code:
tar: <existing file name>: Cannot stat: No such file or directory
where <existing file name> represents an existing and valid file

The file /tmp/filename.tar is created but zero length.
Needless to say without the "-C <dir>" command tar creates the file as normal.

Can anyone identify what I'm doing wrongly here? TIA.
 
TWO WHOLE MINUTES I HAD TO WAIT FOR THAT.
Awesome, 100% correct.

And here's the relevant section from man tar :

Code:
In create mode, the list of files and directories to be archived can also
     include directory change instructions of the form -Cfoo/baz and archive
     inclusions of the form @archive-file.  For example, the command line
	   tar -c -f new.tar foo1 @old.tgz -C/tmp foo2
     will create a new archive new.tar.  tar will read the file foo1 from the
     current directory and add it to the output archive.  It will then read
     each entry from old.tgz and add those entries to the output archive.
     Finally, it will switch to the /tmp directory and add foo2 to the output
     archive.

I think its misleading. Perhaps it's just me.
 
michaelrmgreen said:
TWO WHOLE MINUTES I HAD TO WAIT FOR THAT.
Awesome, 100% correct.

And here's the relevant section from man tar :

Code:
In create mode, the list of files and directories to be archived can also
     include directory change instructions of the form -Cfoo/baz and archive
     inclusions of the form @archive-file.  For example, the command line
	   tar -c -f new.tar foo1 @old.tgz -C/tmp foo2
     will create a new archive new.tar.  tar will read the file foo1 from the
     current directory and add it to the output archive.  It will then read
     each entry from old.tgz and add those entries to the output archive.
     Finally, it will switch to the /tmp directory and add foo2 to the output
     archive.

I think its misleading. Perhaps it's just me.

Made me smile
 
Back
Top