I'm trying to run a loop so that dir will check some file extensions against a bunch of directories. My loops are working as they should all the way up until the most inner loop where I'm trying to get Dir() to loop through the paths\*.fileExtension. I know that the paths are coming out the way they should be because I'm echoing them to make sure. @Error reports a 2 (the manual doesn't say anything about an error 2 in Dir) and @SERROR doesn't report anything... does anyone have any thoughts?
Code:
Break On
$ = SetOption("WrapAtEOL","On")
$dir = 'C:\Documents and Settings\joe.doe\Desktop'
$path = DirList($dir,1+2+4)
$fileExt = ".mp3",
".avi",
".jpg",
".gif"
For $x=0 to ubound($path)
If GetFileAttr($path[$x]) & 16
For Each $y in $fileExt
? $path[$x] + '*' + $y
$z = Dir($path[$x] + '*' + $y)
If @Error <> 0
? @Error + ': ' + @SERROR
Endif
While $z <> "" and @ERROR = 0
? $z
$z = Dir()
Loop
Next
Endif
Next
sleep 20