.zipix bash shell
./zipix is a simple bash script defined at the bottom of this description. barnyard's cygwin setup means that newly open cygwin shells, such as the one depicted in this fotograph, will be
immediately pointed to barnyard's "My Pictures" directory.. in the depicted shell, i have made it to "My Documents"
216 pix are zipped
there are 27 zipfiles
bash-3.2$ cat zipix
i=0
j=0
declare -a pkg[8]
ls $1 > files
while read file; do
pkg[$((i%8))]="$file"
i=$((i+1))
if [ $((i%8)) -eq 0 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" "${1}/${pkg[2]}" "$
{1}/${pkg[3]}" "${1}/${pkg[4]}" "${1}/${pkg[5]}" "${1}/${pkg[6]}" "${1}/${pkg[7]
}" >/dev/null
fi
done < files
if [ $((i%8)) -eq 7 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" "${1}/${pkg[2]}" "$
{1}/${pkg[3]}" "${1}/${pkg[4]}" "${1}/${pkg[5]}" "${1}/${pkg[6]}" >/dev/null
elif [ $((i%8)) -eq 6 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" "${1}/${pkg[2]}" "$
{1}/${pkg[3]}" "${1}/${pkg[4]}" "${1}/${pkg[5]}" >/dev/null
elif [ $((i%8)) -eq 5 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" "${1}/${pkg[2]}" "$
{1}/${pkg[3]}" "${1}/${pkg[4]}" >/dev/null
elif [ $((i%8)) -eq 4 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" "${1}/${pkg[2]}" "$
{1}/${pkg[3]}" >/dev/null
elif [ $((i%8)) -eq 3 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" "${1}/${pkg[2]}"
>/dev/null
elif [ $((i%8)) -eq 2 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" "${1}/${pkg[1]}" >/dev/null
elif [ $((i%8)) -eq 1 ]; then
j=$((j+1))
zip "${1}/${1}${j}.zip" "${1}/${pkg[0]}" >/dev/null
fi
echo "$i pix are zipped"
echo "there are $j zipfiles"
bash-3.2$