[Gambas-user] Directory Walker
Rob
sourceforge-raindog2 at ...94...
Fri Jun 25 20:43:47 CEST 2004
On Friday 25 June 2004 10:51, Daniel Oxley wrote:
> When I did it in VB (sorry) once, I seem to remember using a
> For File in Files command or something.
I think what you're looking for is something like this:
PUBLIC SUB WalkTree(path AS String)
DIM Files AS String[]
DIM f AS String
Files = Dir(path)
FOR EACH f IN Files
IF Stat(path &/ f).Type = gb.Directory THEN
WalkTree(path &/ f)
ELSE
IF LCase(Right(f,4)) = ".jpg" THEN PRINT "Found a jpg: " &
path &/ f
IF LCase(Right(f,4)) = ".mp3" THEN PRINT "Found an mp3: " &
path &/ f
' etc.
ENDIF
NEXT
END
More information about the User
mailing list