これでうまくいってるみたいだけど。

#include "hspext.as"
chdir "C:\\hoge"; ファイルがあるフォルダ
dirlist2h 2
dirlist2 size, "*.txt"
sdim buf, size + 1
dirlist2r buf
mes buf