#!/bin/sh WORKDIR=/Users/adam/tmp/roms WGET=/opt/local/bin/wget for (( i = 2495 ; i <= 2500; i++ )) do $WGET -U "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" -O $WORKDIR/info http://www.rom-world.com/file.php?id=$i SYSTEM=$WORKDIR/`grep System\: $WORKDIR/info | $WORKDIR/strip | cut -d: -f 2` if [ -d $SYSTEM ] then echo else mkdir "$SYSTEM" fi cd "$SYSTEM" $WGET -U "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" http://server1.xgd.com/check/getfile.php?id=$i done