Count of folders in directory? 
Author Message
 Count of folders in directory?

Is there a way to get a count (without iterating throught them) of all the
folders/subfolders on a directory.

If I build a treeview control that replicates the one in explorer, and I
want to use a progress bar to display the progress of loading all the
folders, How can I know what the maximum number is?

thanks,

rut



Sun, 24 Mar 2002 03:00:00 GMT  
 Count of folders in directory?
You can use the FileSystemObject to accomplish this.  Set a reference
to the Microsoft Scripting Runtime and try this example out:

Option Explicit

Private Sub Command1_Click()

  Dim MyFSO As FileSystemObject
  Dim MyFolder As Folder
  Set MyFSO = New FileSystemObject
  Set MyFolder = MyFSO.GetFolder("C:\")
  Debug.Print MyFolder.SubFolders.Count

End Sub

-Dan Beacom


Quote:
>Is there a way to get a count (without iterating throught them) of all the
>folders/subfolders on a directory.

>If I build a treeview control that replicates the one in explorer, and I
>want to use a progress bar to display the progress of loading all the
>folders, How can I know what the maximum number is?

>thanks,

>rut



Mon, 25 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Returning all file names from given folder directory and all sub-directories

2. Create folder that points to a variabel directory (eg for each user his directory)

3. Subject: 16Bit Directory from 32Bit Folder/Directory

4. Subject: 16Bit Directory from 32Bit Folder/Directory

5. Subject: 16Bit Directory from 32Bit Folder/Directory

6. Subject: 16Bit Directory from 32Bit Folder/Directory

7. Start DIRECTORY (FOLDER) for the Browse Folder function

8. Hiding Directories Like Magic Folders or Folder Guard

9. How to get file count in directory

10. Counting Files in a Directory

11. Directory Count

12. counting directory size

 

 
Powered by phpBB® Forum Software