Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

cheers

share|improve this question

1 Answer 1

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
folder1/
folder1/...
folder2/
folder2/...
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. –  trekme Feb 4 '13 at 21:09

Your Answer

 
discard

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.