for dir in *; 
do 
  if [ -d "$dir" ]
  then
    echo "Compressing $dir"
    tar -czf "$dir".tar.gz "$dir"
  fi
done
