Need recursive filelist, anyone?

Previous topic - Next topic

ampos

I need to get all the files with their complete path$ inside a dir.

The files can be also on dirs, or have more dirs... (recursive?)

Anyone?
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ampos

Solved :)

Code (glbasic) Select
REDIM file$[1];file$[0]=""

ok = SETCURRENTDIR(path$) // One up
cur$ = GETCURRENTDIR$()
num = GETFILELIST("*.*", file$[])
num_dir  = INTEGER(num / 0x10000) // Hi-Word
num_file = MOD(num, 0x10000)      // Lo-Word

FOR i=0 TO num_dir-1
file$[i]=file$[i]+"/"
NEXT
DIMDEL file$[],0;DIMDEL file$[],0//;DIMDEL file$[],0

pos=0
REPEAT
t$=file$[pos]
IF RIGHT$(t$,1)="/"
ok=SETCURRENTDIR(path$+t$)
cur$ = GETCURRENTDIR$()
num = GETFILELIST("*.*", temp$[])
num_dir  = INTEGER(num / 0x10000) // Hi-Word
num_file = MOD(num, 0x10000)      // Lo-Word
FOR i=0 TO num_dir-1;temp$[i]=temp$[i]+"/";NEXT
DIMDEL temp$[],0;DIMDEL temp$[],0//;DIMDEL file$[],0
FOREACH tt$ IN temp$[]
IF RIGHT$(tt$,1)="/" THEN DIMPUSH file$[],t$+tt$
IF UCASE$(RIGHT$(tt$,4))=".JPG" THEN DIMPUSH file$[],t$+tt$
IF UCASE$(RIGHT$(tt$,4))=".PNG" THEN DIMPUSH file$[],t$+tt$
NEXT
ENDIF
INC pos
UNTIL pos=BOUNDS(file$[],0) OR MOUSEAXIS(3)=1

FOREACH t$ IN file$[]
           debug t$+"\n"
NEXT
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE