I accidentally omitted your first line, the one starting with adir(). Just put it back in again.
>Dear Sir,
>
>I have test your codes, it shows following error message
>
>Variable AFILELIST is not found
>
>May the first line
>
>FOR i = 1 TO ALEN(aFileList, 1)
>
>is creating problem.
>
>Please modify
>
>Thanks in advance
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)