Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub folder name
Message
From
20/08/2008 06:37:36
 
 
To
19/08/2008 22:25:24
Hee Lim Wang
Fantasy Software Enterprise
Malaysia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01340273
Message ID:
01340320
Views:
14
How to write coding to retrive all sub folder name and save them into a table?

Here is some code to help get you started - call this function with the name of the directory to use as a starting point:
Function GetChildDirectories( tcDirectory )

Local lnDirCnt, laDirs[1], lnCnt

*** add the current directory to the list
INSERT INTO MyAlias ( cDirectory ) VALUES ( tcDirectory )

*** Now see if we have any directories under the current directory
lnDirCnt = Adir( laDirs, tcDirectory + '*.*', 'D' )
If lnDirCnt > 1
  For lnCnt = 1 To lnDirCnt
    If Left( laDirs[ lnCnt, 1 ], 1 ) # '.'
      *** Make sure we have a directory and not a file
      If Directory( tcDirectory + laDirs[ lnCnt, 1 ] )
        GetChildDirectories( tcDirectory + laDirs[ lnCnt, 1 ] + '\')
      Endif
    Endif
  Endfor
Endif
Previous
Reply
Map
View

Click here to load this message in the networking platform