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 ?


1 Answer 1


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
  • yes, that's what I suspected. I guess there is no way to force this behavior onto the finder GUI tool.
    – EarlGrey
    Feb 4, 2013 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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