File Handling - resolving a Directory name

Blitz3D Forums/Blitz3D Programming/File Handling - resolving a Directory name

I am trying to store a directory name as a variable. What the code does is search a folder, and list the first 5 valid (non "." or "..") folders it comes to.

Here's the code:

			temp#=5
			
			Dim a(temp#)
			
			logfile("SYSTEM: COMMENCING PROFILE SEARCH")

count=0

mydir=ReadDir("Profiles")

Repeat

file$=NextFile$(mydir)

a(count)=file$

	logfile("SYSTEM: FOUND "+count+": "+fil$)

If file$=""
	logfile("SYSTEM: END OF LIST")
	Exit
EndIf

If Right$(a(count),1)="." Or FileType(a(count))<>2
		logfile("SYSTEM: INVALID DIRECTORY")
	Else count=count+1
EndIf
	
Forever
			
			logfile("PROFILES LIMITED TO "+temp#)