Number of files in a folder including sub-folders

S

steve.kite

In the Windows Folder Properties dialog box, the size of a folder is
displayed, and the number of Files and Folders contained within the
folder are displayed.

In VBA, through Scripting.FileSystemObject it is possible to access
the size of the folder (including sub-folders) but the only way to
access the number of foldes and files appears to be to loop though
each sub-folder and count the files using a recursive function. This
is a slow process when dealing with a lot of sub-folders, eg a whole
drive. Surely it must be possible to access the "Contains" data from
the Folder Properties dialog box and return the total number of Files
and Folders directly.

Does anyone know how to do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top