in reply to Directory Recursion Disorder
You need to prepend $directory when you do your filetest:
if (-d "$directory/$dir") [download]
HTH
yep, that's it. If I only had a dime for everytime I made that mistake... I'd have about 40 cents ;-). Thanks.