Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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"

share|improve this question
add comment

2 Answers

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

share|improve this answer
    
Do you know of any archivers which do work in the way I'm hoping? –  Gareth Aug 24 '11 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 Aug 24 '11 at 17:23
add comment

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.

share|improve this answer
add comment

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.