Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drilling Down into the Folders
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01004860
Message ID:
01004864
Views:
21
This message has been marked as the solution to the initial question of the thread.
CREATE CURSOR TablesWithCharField (cTableNam M)
GetFolderTables("R:\ROOT")

FUNCTION GetFolerTables(cFolder)
 LOCAL nDirs, nFiles, cntr, cntr1, numb_fields
 LOCAL ARRAY aFiles[1]
 cFolder = ADDBS(cFolder)
 nDirs = ADIR(aFiles, cFolder+"*.*","D")
 FOR cntr = 1 TO nDirs
     IF NOT (aFiles[cntr,1] == "." OR aFiles[cntr,1] == "..")
        GetFolerTables(cFolder+aFiles[cntr,1])
     ENDIF
 NEXT
 LOCAL ARRAY aFiles[1]
 nDirs = ADIR(aFiles, cFolder+"*.DBF")
 FOR cntr = 1 TO nDirs
     USE (cFolder+aFiles[cntr,1]) ALIAS TestFile IN 0
     numb_fields = AFIELDS(aFlds, "TestFile")
     FOR cntr1 = 1 TO numb_fields
         IF aFlds[cntr1, 2]== "C" .AND.;
            aFlds[cntr1, 3]== 10
            INSERT INTO TablesWithCharField VALUES (cFolder+aFiles[cntr,1])
            EXIT
         ENDIF
    NEXT
    USE IN TestFile
 NEXT

RETURN ""
(not Tested)


>Hey Gurus!
>
>Given a folder
>
>R:\ROOT
>
>and subfolders
>
>R:\ROOT\ONE
>R:\ROOT\TWO
>R:\ROOT\THREE
>.....
>R:\ROOT\FINAL where we don't know how many sub-folders there are (IMPORTANT!!)
>
>I need to find all tables in these subfolders, including the root, that have at
>least one field with Character Type and Length of 10 (C-10).
>
>Output can go to another final table.
>
>Any ideas? Been done before?
>
>Thanks!!
>
>Tommy
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform