Here is yet another bash script 07.26.2007 14:59
Printer Friendly

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. : D (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

Back to Eblog

Latest two blog entries:
Weird Java Time problem
Lotus Notes Sametime with Pidgin (or gaim)


Make a comment!
Comments will be approved first to prevent suckers to misuse/abuse my comments section. So, there is a delay!
No html tags are allowed. Text is your friend ;)
I will never use your email for bad purposes, so, chill.. ;)

Date: 05.16.2008 22:35
Name:
Email:
URL:
Subject:
Comment:
Please type the number you see in this picture to the box below.