Wednesday, February 26, 2020

#1 2019-04-25 04:05:38 am

Registered: 2009-09-30
Posts: 125

zip a folder

Hello, I simply want to zip a folder on my desktop and I can't find anything relating to that in any dictionary. Do somebody have the command to do that?

Thanks in advance!

Last edited by sbriss (2019-04-25 04:06:04 am)



#2 2019-04-25 07:26:33 am

From:: Takamatsu, Japan
Registered: 2015-04-17
Posts: 19

Re: zip a folder

I wrote a script to add a password when zipping files, it was discussed here but the direct link is : … -with.html



#3 2019-04-25 10:34:40 am

From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 352

Re: zip a folder

The simplest method to archive a folder is to select it in the Finder or on the desktop and then to select the compress-folder command from the context (right-click) or top File menu.

If the OP has some particular archive requirements, or just FWIW, the following is a simple script that mimics the behavior of the Finder compress-folder command. After prompting for the folder to be compressed, the script creates an archive of the selected folder in its parent folder.


--Prompt for source folder.
set selectedFolder to choose folder
set selectedFolder to POSIX path of selectedFolder

--Set variable to path to and name of archive file.
   set archiveFile to text 1 thru -2 of selectedFolder
on error
   display dialog "Folder selection error." buttons {"Cancel"} with icon stop
end try

--Create archive file (credit to brandelune).
do shell script "cd " & (quoted form of selectedFolder) & "; zip -r " & (quoted form of archiveFile) & " *"

Last edited by peavine (2019-04-26 06:59:58 pm)

2018 Mac mini - macOS Catalina



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)