Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Caesar_091

macrumors 6502
Original poster
Jan 18, 2005
289
12
Italy
Hi all,

do you know an easy way (or app) to compress multiple (big) folders to single archives with a configurable queue to avoid to overflow the system?

I have more than 100 folders (3 to 5GB each) and I want to compress each folder into a single zip archive.
What I really want is to automate the process for example using Keka which gives me a good compression rate with the ZIP format (but using Keka I can't select the maximum number of tasks that i really don't want to be more than 2-3 at a time even if it's multi-threaded).

Thanks in advances :)

PS: these were not fully useful since the huge number of folders I have to compress.
 
Does the folder list remain the same or are you adding/subtracting folders over time? Are they all in the same directory?

Is there a specific location, other than the original locations, to which you want the zipped files save?
 
The idea is to compress the folders as they are right now: all in the same directory and the output would be the original location (or a secondary HD if needed).
 
Sorry but man, you definitely ask a lot of questions :)
The list of folders is static/fixed.

Right now I'm struggling with Automator ma can't find a way to configure the number of concurrently task to run.
 
If you set up an Automator app with two steps for every folder...
  1. "Get Specified Finder Items" (with "Ignore this action's input" checked)
  2. "Create Archive"
...it will create the archives one at a time.
 
Yes but it will create a single big archive and not one for each folder.
[doublepost=1512068341][/doublepost]This Automator service would work even if will compress only one folder at time:
Code:
for f in "$@"; do

    dn="$(dirname "$f")"
    bn="$(basename "$f")"

    pushd "$dn"

    if [[ ! -e "$bn.zip" ]]; then
        ditto -c -k --sequesterRsrc --keepParent "$f" "$bn.zip"
    else
        n=2
        for i in $bn *.zip; do
            if [[ "$bn $n.zip" == "$i" ]]; then
                n="$(( $n + 1 ))"
            fi
        done
        ditto -c -k --sequesterRsrc --keepParent "$f" "$bn $n.zip"
    fi

done

afplay /System/Library/Sounds/Purr.aiff

Do you know how to add the compression level to the ZIP command?
[doublepost=1512069268][/doublepost]Adding the "--zlibCompressionLevel 9" to the ditto string will do the job but the compression level is unseemly if compared to Keka's and it's not multi-threaded. Any suggestion on how to automate Keka?
 
Last edited:
The below Automator app creates one archive of each folder. The top two commands are repeated below (you can only see 3 of 4). So you’d have to repeat the two actions for each folder.

r.png
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.