#!/bin/sh
for dir in 35devupdate 36devupdate 37devupdate 42devupdate 43devupdate
do
echo looking for builds in $dir
cd ~/$dir
numz=`ls *.zip | wc -l`
echo $numz builds found
if [ $numz -gt 4 ]
then
 echo too many builds
 oldest=`ls *.zip | head -1`
 echo removing oldest build: $oldest
 t=${oldest%_archive.zip}
 id=${t##ajdt[^\.]*\.}
 echo Timestamp is $id
 if [ ${id}x != x ]
 then
  echo removing jars with build id: $id
  # move zip and matching files under features and plugins dirs
  mv $oldest old
 fi
fi
done
