Task

Walk a given directory and print the names of files matching a given pattern.

(How is "pattern" defined? substring match? DOS pattern? BASH pattern? ZSH pattern? Perl regular expression?)


Note: This task is for non-recursive methods.   These tasks should read a single directory, not an entire directory tree.

Note: Please be careful when running any code presented here.



Related task

   Walk Directory Tree   (read entire directory tree). 


files #g, DefaultDir$ + "\*.jpg"   ' find all jpg files 
 
if #g HASANSWER() then
	count = #g rowcount()	' get count of files
	for i = 1 to count
	if #g hasanswer() then	'retrieve info for next file
		#g nextfile$()	'print name of file
		print #g NAME$()
	end if
	next
end if
wait