Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • ya, 'f' option must be last, as it specifies the filename. You're going to create an archive named T, but it'll error on missing tarfilename.tar file anyways.
    – lornix
    Commented Jul 14, 2012 at 19:41
  • 2
    One reason to create an empty tar: scripted tar creation. Step 1: Create the tar. Step 2: Add files one by one. You can do this with an "if first file then create else then append" but that's not as smooth. Commented Nov 29, 2012 at 17:53
  • 5
    @dpk: If I understand what you are saying, why don't you just always use append? Append will create the tar file if it doesn't already exist, so you don't need to check if it's the first file, just append and if it's the first file tar will create it. Commented Dec 16, 2012 at 2:42
  • 1
    @SeanReifschneider It looks like that'd work fine. Nice. Commented Dec 17, 2012 at 23:14
  • 1
    @SeanReifschneider: +1 for the hint that append mode creates the archive for the first file if it's not already on disk. I'm using find command to exec tar in append mode in a script so didn't need to create the archive file before-hand.
    – GuruM
    Commented Jul 29, 2013 at 8:40