My first suggestion is not to use the SHELL command. Read the manual about the USE command. Also search the board for any number of MapDrive UDF's that will make you life easier.

Once you understand these aspects then look into your looping.
_________________________
Home page: http://www.kixhelp.com/hb/