getting directories

BlitzMax Forums/BlitzMax Beginners Area/getting directories

Gavin Beard(Posted 2005) [#1]
Hi all,

I know this is prob. pretty easy but how do i get a list of sub directories within a directory?

i.e i have a directoy sctructure like so:
~/users
~/users/gavin
~/users/mark
~/users/dave

i want to scan thru the ~/users dir and create get the names of all the sub dirs to store in an array?

thanks alot


Scott Shaver(Posted 2005) [#2]
check out ReadDir
LoadDir
ChangeDir
NextFile

Shows up under the File System node in the help.


Gavin Beard(Posted 2005) [#3]
thx :)


deps(Posted 2005) [#4]
strict

Local dir:String[]
dir = LoadDir( CurrentDir() )

For Local i:Int = 0 Until Len(dir)

	If FileType( dir[i] ) = 2 Then
		' dir[i] is a directory
		Print dir[i]
	ElseIf FileType( dir[i] ) = 1 Then
		' dir[i] is a file
	EndIf
	
Next




Gavin Beard(Posted 2005) [#5]
thx, that works a treat