PROCEDURE filetree

PARAMETER lcpath

CREATE CURSOR filetree (name C(100),;
                                                size N(9), ;
                                                update D,;
                                                uptime C(8),;
                                                attr C(8),;
                                                path C(100);
                                                )

INDEX ON name TAG name
INDEX ON path + name TAG pathname                                       

IF EMPTY(lcpath)
        lcpath = FULLPATH(CURDIR())
ENDIF
DO treewalk WITH lcpath
WAIT CLEAR
RETURN

PROCEDURE treewalk
PARAMETERS lcpath
PRIVATE ALL LIKE l*
IF ADIR(lafilelist,lcpath+"*.*") # 0
        =storeit(@lafilelist,lcpath)
ENDIF
lndircount = ADIR(lasubdirs,lcpath+"*.*","D")
IF lndircount > 0
        FOR lncount = 1 TO lndircount
                IF RIGHT(lasubdirs[lncount,5],1) ="D" AND ;
                  LEFT(lasubdirs[lncount,1],1) # "."
                        DO treewalk WITH lcpath+lasubdirs[lncount,1]+"\"
                ENDIF
        NEXT
ENDIF
RETURN

PROCEDURE storeit
PARAMETERS lafiles,lcpath
IF .F.
        DIMENSION lafiles[1,1]  
ENDIF   
IF TYPE("lafiles[1]") # "U" AND !EMPTY(lafiles[1])
        FOR lncount = 1 TO ALEN(lafiles,1)
                INSERT INTO filetree values;
                (lafiles[lncount,1],lafiles[lncount,2],;
                lafiles[lncount,3],lafiles[lncount,4],;
                lafiles[lncount,5],lcpath)
        NEXT
ENDIF
RETURN


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/a2b0cc710901121106t27894cc5o473f61cd3b255...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to