$dirtoget="/home/yourname/www/images/"; opendir(IMD, $dirtoget) || die("Cannot open directory"); @thefiles= readdir(IMD); closedir(IMD);