On 10/11/2012 4:02, Alex Antener wrote:
I don't know if this is worth a bug report, but it looks like GNU tar does not
accept wildcards in combination of the -C option.
This works for me:
tar czf foobar.tar.gz *.sql
as well as
tar -C ~/foobar -czf foobar.tar.gz foobar.sql
but the following command exits with an error:
tar -C ~/foobar -czf foobar.tar.gz *.sql
tar: *.sql: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
... is it me or is it GNU tar?
When creating or updating tar archives, -C stands for the new directory
where to work with the tar archive, but files are still referred from
current dir, so try this:
tar -C ~/foobar -czf foobar.tar.gz ~/foobar/*.sql
For extracting, you don't need such, and star behaves the same.
The problem is that the files are not stored relative, where should be
$ tar -tf foobar.tar.gz
a.sql
b.sql
It is
home/user/foobar/a.sql
home/user/foobar/b.sql