At the moment, if I create a TAR or ZIP file foo.tar - containing multiple files and directories - when I double click on the archive it creates a folder foo containing all of the archived items.

Is there a way to have an archive extract itself - when opened from Finder - so that the files are at the same level as the archive was?

I'm trying to distribute an archive which users can use to setup a USB drive with a custom icon etc, however this requires copying hidden files into the USB drive's root, so I can't just get them to "copy/paste from this network directory"

2 Answers 2


Unless I am mistaken (always a possibility), this behavior is set by the program extracting the archive file, not by the archive file itself.

  • Do you know of any archivers which do work in the way I'm hoping?
    – Gareth
    Commented Aug 24, 2011 at 17:11
  • It wouldn't really matter, because it's up to the unarchiver. You would need to get people to install an unarchiver, and possibly set its preferences, before they extracted your archive. Which sounds like more trouble than it's worth.
    – Adam Rice
    Commented Aug 24, 2011 at 17:23

The way I would do this is:

  1. Create your .zip file, foo.zip with the desired USB drive contents.
  2. Create an applescript named USB Drive Installer or whatever:

    tell application "Finder" to get folder of (path to me) as Unicode text
    set myDir to POSIX path of result
    set DestinationDirectory to choose folder with prompt "Select USB Drive Destination"
    do shell script "/usr/bin/ditto -xk " & myDir & "/foo.zip" & quoted form of DestinationDirectory
  3. Create another .zip with those two files. Provide instructions to run the applescript after the files are extracted.

You must log in to answer this question.

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