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