Run the following simple oneliner to download and "install" the service:
curl -L https://dl.dropbox.com/s/wpxbnm8y6gb6l32/compressWithPassword.tar.gz | tar zx -C ~/Library/Services/
And while selecting files or folders in Finder you will find the new option
Services
> Compress with password
Note: as of today will only work with one file or directory at a time.
💥
Check passwordWithExpect.sh
to see the script that this service runs.
Nothice that I didn't use zip
's --password
parameter that would entail the dangers of command logging. Instead, I used expect
to pass the password directly to the zip function. Given that Automator
services do not support expect
scripts, I had to wrap it on a bash script. For the curious minds, -f -
defines that expect
will be using standard input. Then the following "$@
allows to send the function parameters to expect
that will be extracted with [lindex $argv <number>]
. Other than that you know what <<
means, and everything between !
will be the input sent to expect
. Awesome, right?