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/mb.com/melinda.tar.gz --exclude-tag=NOBAK.TAG -C /bak/mb.com *

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/mb.com 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 mb.com as its top level, but all the files and directories under mb.com. (I am relaxed about including the files/directories starting with a dot, although on balance I would prefer that they be included).
--
Alan Chandler
http://www.chandlerfamily.org.uk


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/4C559BD5.1000107@xxxxxxxxxxxxxxxxxxxxx



Relevant Pages

  • usb2 port gets very slow on 2-gig Flash Drive.
    ... I needed to reload the flash drive on a Zenstone 2-gig mp3 ... It is July 24 and ps ax -Olstart shows me that tar has ... several minutes between the rm -r -f command to wipe the FAT ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: A silly question about tar
    ... tar: emerald-0.2.0.tar.bz2: Not found in archive ... But if I run the same command on a ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Re: usb2 port gets very slow on 2-gig Flash Drive.
    ... You make all the filesystem changes to a disk image on your hard disk, ... It is July 24 and ps ax -Olstart shows me that tar has ... several minutes between the rm -r -f command to wipe the FAT ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: GNU tar problem
    ... ancient version of 'tar' might have been. ... executed when you call "tar" on the command line. ... of your tar program. ... I had a copy of the Gnu tar source so I built a ...
    (comp.arch.embedded)
  • Re: tar command dangerously written
    ... > prompt an overwrite with the tar command - most user friendly tools ... If I ask tar to create an archive every night, ... It could prompt you for missing arguments, ...
    (comp.unix.shell)