|
<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > File > DIR: functions working on directories > DIR_ListSubDirs |
Description
Recursively fill a string array variable with the list of sub directories found starting from an initial path.
Function will return number of sub directories found.
Syntax
nDirs = DIR_ListSubDirs(StringArrayVariable, Initial_Path [, NoRecursive])
Returns
Number: number of directories found.
Return value will always be at least 1 because Initial_Path will always indicated as element number 1 of the returned array
Parameters
Name |
Type |
Optional |
Meaning |
StringArrayVariable |
String |
No |
An already defined string array variable that will receive file names found |
Initial_Path |
String |
No |
Path to search into. Examples: "C:\Temp\" "C:\" |
NoRecursive |
Number |
Yes |
By default function is recursive and will loop for all sub directories. |
Remarks
This function will automatically dimension StringArrayVariable based on the number of directories found.
First element of StringArrayVariable array will always be Initial_Path.
Restrictions
See also
Examples
Sample script
USES "FILE"
Dim MyDirs() As String
Dim nDirs As Long
nDirs = DIR_ListSubDirs(MyDirs, "C:\thinBasic\SampleScripts\")
MSGBOX 0, "Number of dirs found: " & nDirs
'---MyDirs will now contains the list of directories found