bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Wildcard in combination of "-C" option


From: Live user
Subject: Re: [Bug-tar] Wildcard in combination of "-C" option
Date: Sat, 10 Nov 2012 12:13:00 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]