Does this work any better:

Code:

Break On

$ = SetOption("WrapAtEOL","On")

$dir = '%USERPROFILE%\Desktop'
$path = DirPlus($dir,"/ad /s")
$fileExt = ".mp3",
".avi",
".jpg",
".gif"

For Each $x in $path
For Each $y in $fileExt
$z = Dir($x+'\*'+$y)
While @ERROR = 0
? $z
$z = Dir()
Loop
Next
Next

sleep 20