Code archives/Algorithms/Recirsive ScanDir() func

This code has been declared by its author to be Public Domain code.

Download source code

Recirsive ScanDir() func by Devils Child
(Posted 21 years ago)
this is a lil scandir function(if someone needs...)
i have made it within 5 minutes :) but it meight be helpful for noobs...
Graphics 1280, 1024, 32, 1
SetBuffer BackBuffer()
AppTitle "ScanDir"

ScanDir("c:\Windows\")
WaitKey()
End

Function ScanDir(path$)
dir = ReadDir(path$)
Repeat
	file$ = NextFile(dir)
	If file$ = "" Then Exit
	If file$ <> "." And file$ <> ".." Then
		Select FileType(path$ + file$)
			Case 1
				Color 0, 255, 0
				Print "File: " + path$ + file$
			Case 2
				Color 255, 0, 0
				Print "Dir: " + path$ + file$ + "\"
				ScanDir(path$ + file$ + "\")
		End Select
	EndIf
Forever
CloseDir dir
End Function