ISSourceFolder.GetFolders

Description

This function returns the list of the source folders with the specified paths.

Syntax

object.GetFolders(aPath)

Part Attribute Type Description
object Required
The object always implements the ISSourceFolder interface
aPath In, Required
string
The path of the source folder

Return Value

ISSourceFolders

Returns the list of the source folders with the specified paths.

Example

Create new folders with the specified paths and display some information about the folder tree, including its parent folders.

sub main
  Dim aStore
  Dim aMessage
    
  set aStore = Profile.SourceStore
  EnsureFolder aStore, "Examples"
  EnsureFolder aStore, "Examples/Part1"
  EnsureFolder aStore, "Examples/Part2"  
 
  aMessage = GetSubfoldersInfo(aStore.GetFolders(""), 0)

  Profile.MsgBox(aMessage)
end sub


function GetSubfoldersInfo(aFolders, aLevel)
  Dim i  
  Dim aFolder, aSubFolders
  Dim aInfo
  
  for i = 0 to aFolders.Count - 1
    set aFolder = aFolders.GetItem(i)
    aInfo = aInfo & vbNewLine & Space(aLevel * 4) & aFolder.FullPath &_
      " (Parent: '" & aFolder.GetParentFolder.FullPath & "')"
    set aSubFolders = aFolder.GetFolders(aFolder.FullPath) 
    aInfo = aInfo & GetSubfoldersInfo(aSubFolders, aLevel + 1)
  next
  
  GetSubfoldersInfo = aInfo
end function
       
    
sub EnsureFolder(aStore, aFolderName)
  Dim aFolder

  on error resume next 
  set aFolder = aStore.GetFolder(aFolderName)
  if Err.Number <> 0 Then
    Err.Clear  
    set aFolder = aStore.CreateFolder(aFolderName)
    Profile.MsgBox("The folder '" & aFolder.FullPath & "' was created")
  end if  
end sub
Note:

Version information

Added in v7.8.0