Server Fault is a question and answer site for system and network administrators. 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 have a need to create a tar of two sibling folders and send it to a client for extraction on their Mac OS desktop by double-clicking it. yes, that's a requirement of theirs.

so I go:

cd ~/Desktop
tar -cvf ~/Desktop/files.tar folder1 folder2
#folder1 and folder2 are sibling sub folders of ~/Desktop and contain additional files and sub folders

the problem is that when I (or the client) double click on files.tar (which initiates the extraction), it first creates a top level directory called files and only then the two sub folders (~/Desktop/files/folder1 and ~/Desktop/files/folder2) ... rather than creating ~/Desktop/folder1 and ~/Desktop/folder2. This creates a problem for the client with path dependencies.

is there a way to force a creation of such a .tar or .zip that doesn't create the top level folder first ? (with the name made up from its file name) and extracts the content directly to the current location ?


share|improve this question
up vote 0 down vote accepted

Whatever GUI tool you're using in OS X is doing that, not tar. If you actually use tar to extract the file, you will get the expected directory structure.

$ tar xvf files.tar
share|improve this answer
yes, that's what I suspected. I guess there is no way to force this behavior onto the finder GUI tool. – TrekOnTV2017 Feb 4 '13 at 21:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.