Help creating zip files with 50 files in each I have a folder containing 7.000 images that needs to be zipped into zip files containing only 50 files each.

Any way of doing this automatically? Any script, Automator workflow, batch whatever would be helpful.

I am not very experienced in using either, so please be specific.

I am running OS X Yosemite.
Here's a quick and dirty BASH script.

Assumptions: All of your photos are in a folder, and there's nothing else in this folder.

#!/bin/bash
zip_count=0
files_zipped=0
folder_number=1
div=50
numfiles=(*)
numfiles=${#numfiles[@]}

mkdir zips

for file in *
do

  file_list="$file_list \"$file\""
  let "zip_count=zip_count+1"
  let "files_zipped=files_zipped+1"

  if [ "$files_zipped" -eq "$numfiles" ]; then
    echo "Final ZIP..."
    echo $file_list | xargs zip -9 zips/$folder_number.zip
  fi

  if [ "$zip_count" -eq "$div" ]; then
    echo "Next Zip..."
    echo $file_list | xargs zip zips/$folder_number.zip
    let "folder_number=folder_number+1"
    zip_count=0
    file_list=""
  fi

done


You can download it here

Once you've downloaded it:


Open Terminal.app and change to the directory with your photos in it e.g. cd /path/to/photos
Run the commmand bash ~/Downloads/zip50.sh (assuming you've downloaded the script to your downloads folder.)
A new folder called "zips" will be created in the folder with your photos.