Sunday, September 22, 2019

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

sbriss
Member
Registered: 2009-09-30
Posts: 117

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)

Offline

 

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

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

Re: zip a folder

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

https://mac4translators.blogspot.com/20 … -with.html

Offline

 

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

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 159

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.

Applescript:


--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.
try
   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 Mojave

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)