Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use tar to tar files before transfer, so I can keep the entire file path rather than losing it along the way. However, when I try to tar an empty folder, it tells me that it is cowardly refusing to create an empty archive. I want to keep the empty folder on the other end, but don't want to put anything else into the archive to make it non-empty. Is there any way to do this?

share|improve this question
Works fine here. How are you doing it? – Ignacio Vazquez-Abrams Apr 21 '10 at 1:58
up vote 2 down vote accepted

What command are you using? I am able to create a tar archive of an empty directory just fine:

[jnet@Stan tmp]$ mkdir test
[jnet@Stan tmp]$ tar -cf test.tar test
[jnet@Stan tmp]$ ls -lh test.tar 
-rw-r--r--  1 jnet  wheel    10K Apr 20 21:58 test.tar
share|improve this answer
Looking at your answer, I realized I forgot the first argument... so this is really just an ID10T error. Thanks for helping anyway! – snostorm Apr 21 '10 at 2:03
You know it's cowardly to create an empty archive right? ;-) – Josh Apr 21 '10 at 2:18
@josh: i'm pretty sure it was the refusal to create an empty archive that was "cowardly". tho i'm not remembering who says that. is that a tar error or somebody else? – quack quixote Apr 21 '10 at 3:15
snostorm@ubuntu:~$ tar -cf filename tar: Cowardly refusing to create an empty archive Try tar --help' or tar --usage' for more information. – snostorm Apr 21 '10 at 11:32
So that's a tar error. :) – snostorm Apr 21 '10 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .