[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] Wildcard in combination of "-C" option
From: |
Joerg Weilbier |
Subject: |
Re: [Bug-tar] Wildcard in combination of "-C" option |
Date: |
Sat, 10 Nov 2012 11:59:12 +0100 |
User-agent: |
KMail/1.13.7 (Linux/3.2.0-1-amd64; KDE/4.8.4; x86_64; ; ) |
Am Samstag, 10. November 2012, 04:02:58 schrieb Alex Antener:
> 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
tar can't interpret patterns for include
Your first command
tar czf foobar.tar.gz *.sql
works, because *.sql is expanded by your shell to "foobar.sql", immediately
_before_ starting tar.
With:
tar -C ~/foobar -czf foobar.tar.gz *.sql
the shell can't expand "*.sql", because there is no file on current dir (before
starting tar). So it's not expanded and given to tar.
Then tar starts, changes to "~/foobar" and finds no file '*.sql' (as literal
name, not as a pattern!!!) - error message is thrown.
Tar can't interprete patterns for include.
There are some solutions to create a file list and give it to tar.
I would find one, but it will be never perfect, and may be work only to the
shell, I prefer.
Try to find "tar include" at the web ...
--
Jörg