How to "Extract to" on Mac? Don't want files extracted to same folder

Discussion in 'macOS' started by madsylar, Jun 8, 2010.

  1. madsylar macrumors member

    Joined:
    May 5, 2010
    #1
    Hi.

    On Windows, you can right click a file and choose either "Extract to" -> and choose where, or "Extract to FileNameAsDirectory".

    On the Mac, using stuffit or pathfinder, every time that I open a zip or rar file it extracts to the directory without any question.

    How can I get those items on the context menu ? I'd like to have both,
    1) Extract to -> and choose
    2) Extract to Filename (ie, if file is trip_images.zip, i can choose to extract to trip_images new directory).

    Please check attachment.

    Thank you
     

    Attached Files:

  2. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    Technically that was added to Windows with 3rd party software. WinRAR I believe.

    There are a number of 3rd party unzip tools, for Mac OS, that probably add those items to contextual menus.

    You can also accomplish this with Services. While there are no built in Extraction tools in Automator, this can be done pretty easily with Applescript.

    Code:
    on run {input, parameters}
    	
    	repeat with i from 1 to count input
    		set inputFile to quoted form of POSIX path of input's item i
    		set destFolder to quoted form of POSIX path of (choose folder with prompt "Choose the folder you wish to extract to...")
    		do shell script "unzip " & inputFile & " -d " & destFolder
    	end repeat
    end run
    This is a very basic script and assumes very little about what you want. However, it does work and allows you to select multiple zips and define different locations for each.

    To use it:

    1. Open Automator
    2. Select the "Service" template.
    3. At the top, Select, Services receives selected: "files and folders" in "Finder"
    4. Drag the "Run Applescript" action into the workflow
    5. Copy and paste the script above into the Run Applescript action
    6. Save the workflow, give it a name like "Extract to..."
    7. Now, right click on a zip file, go down to Services and select the action

    Some notes:
    1. This will appear for any file or folder not just zips.
    2. In its current form, it does not tell you which file you are choosing to extract. Since it is something I just threw together, I didn't add many features, just the basic structure.
     
  3. Fuzati macrumors newbie

    Joined:
    Oct 17, 2013
    #3
    This post deserved a thank you. So I just registered and now my evening can be complete: thank you for you help !
     
  4. madsylar thread starter macrumors member

    Joined:
    May 5, 2010
    #4
    Hi calderone,

    I was the original poster and didn't even say thank you. I forgot to check the subscription option to receive emails with replies and just assumed this wasn't replied at all.

    Many thanks for your help and sorry everyone to resurrect a thread from 2010.

    Also thanks Fuzati for the reminder.

    Cheers,

    leo
     

Share This Page