How do I check a folder for files?

Blitz3D Forums/Blitz3D Beginners Area/How do I check a folder for files?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Save this code to a .bb file, and put it in a folder with some images in it. Then run it with debug on.
scanfolder(CurrentDir$())

Function ScanFolder(Path$)
	Dir = ReadDir(Path$)
	Repeat
		File$ = NextFile(Dir)
		If File$ = "" Then Exit
		If IsGraphicsFile(Path$+File$) = True
			;SHOW IMAGE ETC
			DebugLog File$
		EndIf
	Forever
End Function

Function IsGraphicsFile(File$)
	file$ = Lower$(file$)
	ext$ = Right$(file$,3)
	If ext$ = "jpg" Or ext$ = "png" Or ext$ = "tga" Or ext$ = "bmp"
		Return True
	EndIf	
End Function