I usually end up writing some stupid, sometimes pointless bash scripts. Once in a while, if i`m not in hurry, I share them on my blog. If I needed once, someone else might need it too.
This time the script is about having too many jpg files and putting them in zip files that contains only 19 pictures. (This was because of a limitation of a free picture hosting site that I will not name them here, cause they suck!)
Here we go
#!/bin/bash
#Set the initial counters.
A=1;J=0;
#loop for the file in this directory
for i in *.jpg
do
#ZIPPY is where I collect all the files
ZIPPY=”$ZIPPY $i”
#HERE we count the files and use
#modulo operation to find the 19th file
let “J=$J+1”
let “REST=$J % 19”
if [ “$REST” -eq 0 ]
then
# The rest is easy
zip bolum$A.zip $ZIPPY
ZIPPY=””
let “A=$A+1”
fi
done