Applescript or Automator command to .zipx a folder in WinZip Mac

565 Views Asked by At

I'm trying to use Hazel automate a process in which I currently manually zip a completed project folder with WinZip Mac into .zipx format, then transfer it to an Archive folder on my NAS. I know there's an archive function built in, but the .zipx format compresses the data more, which is vital for the size of the folders I'm working with.

Hazel can run Applescript, Automator workflow and shell scripts, so I'm hoping at least one of these methods will work.

I've already got a rule set up to move any .zipx files from my project folder to the NAS, I just need to know if there's an easy way to script a command to make WinZip create a .zipx file, using the folder's name as the zip file name (i.e., the folder 20130814 - Project 2 becomes 20130814 - Project 2.zipx. The trigger would be changing the folder's colour to green.

I couldn't find anything specific to WinZip Mac regarding CLI, so I'm not even sure if this is possible, but if so it will save me a lot of repetitive chores!

Anyone have any idea how to set this up?

1

There are 1 best solutions below

0
On

I would use the below script. if you change the variables at the top to suit your needs. this will do the backing up, transferring to the NAS(If it supports SCP) and also clean up afterwards.

I have also added some error checking in incase there is an issue with the tar/scp as you don't want there to be an issue with your backups.

#!/bin/bash

directory="/Users/$USER"
archive="/home/backup"
date=$(date +"%d%m%Y")
filename="backup"
NAS="Hostname/IP of NAS"
backup="path to save on NAS"


tar -cvzf $archive/$filename-$date.tgz $directory
if [ $? == 0 ]; then
     echo "success"
else
     echo "error"
     exit 1
fi

#only use the below code if your NAS can use ssh/scp
scp $archive/$filename-$date.tgz $NAS:/$NAS-backup
if [ $? == 0 ]; then
    rm $archive/$filename-$date.tgz
else
    echo "error"
    exit 1
fi