0

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

EarlGrey
  • 103
  • 2

1 Answers1

0

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/...
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • yes, that's what I suspected. I guess there is no way to force this behavior onto the finder GUI tool. – EarlGrey Feb 04 '13 at 21:09