Linux Archive

Linux Archive (
-   Debian User (
-   -   Help with Tar command (

Alan Chandler 08-01-2010 04:07 PM

Help with Tar command
I am using tar within a monthly cron job, and found that my command line
has an error. I 'think' I understand what it is, but I can't find any
examples or explanation by reading the tar manual on the GNU website, or
generally using google of how to work round it.

I presume my cron job is being run with the current directory as
filesystem root, because this command line

tar -czf /bak/archive/snap/ --exclude-tag=NOBAK.TAG
-C /bak/ *

complains that it can't find many of the root level directories.

I suspect the * here is being expanded by the shell before it calls tar,
which is what causes the problem. How can I tell tar to copy all the
files in the /bak/ directory into the archive (exluding the
directories that have a file called NOBAK.TAG in them) in such a way
that the inside of the tar archive does NOT have the directory as
its top level, but all the files and directories under (I am
relaxed about including the files/directories starting with a dot,
although on balance I would prefer that they be included).

Alan Chandler

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact


All times are GMT. The time now is 04:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.