Unzip file without shell script

I’m building a basic installer that unzips a file into a specific folder on the users system.

I’m currently using

tell me to do shell script "ditto -x -k " & quoted form of the POSIX path of sourceZip & space & userFolder

is there a better way without using a shell script?

I’d almost always prefer to tell “System Events” unless there’s something specific to the library you’re targeting (whatever “me” is in this circumstance.)

For executing a shell script I’d prefer targeting System Events.

And re “a better way to do this”: no, I’d argue that a shell script is always the best method when it does the job.

I’m a huge proponent of Unix-first script solutions. Whether it’s supporting Applescript or Keyboard Maestro workflows, what Unix lacks in approachability it more than makes up for in power and cojones.

1 Like

Thanks Any guesses as to why this wont work

		set sourceZip to ((path to me as text) & "Contents:Resources:A.zip") as string
	set AppsFolder to path to applications folder
	set theCM to "ditto -x -k " & quoted form of the POSIX path of sourceZip & space & quoted form of the POSIX path of AppsFolder
	do shell script theCM with administrator privileges

I tried it with an app zipped to A.zip, and it worked perfectly here, under Ventura.