Number of files in a folder including sub-folders
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? |
Number of files in a folder including sub-folders
See if this will work for you, from Ken Puls
http://www.vbaexpress.com/kb/getarticle.php?kb_id=238 -- -John Please rate when your question is answered to help us and others know what is helpful. " wrote: 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? |
All times are GMT +1. The time now is 10:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com