>Hi
>
>Could anyone advise how to return the total number of folders that exists on a drive(s).
>
>It's for use in a progressbar calculation for a file search .prg
>
>TIA
>
>Dennis
Dennis,
You would have to build a recursive routine that used the Scripting.Filesystemobject object to drill down into your drive. Create following as procedure or program GetFolderCount:
lparameter tcdir
local ofso as Scripting.FileSystemObject, ofolder as Scripting.Folder, oFoldertmp as Scripting.Folder
local lncount
lncount = 0
ofso = createobject('scripting.filesystemobject')
ofolder = ofso.GetFolder(tcdir)
for each oFoldertmp in oFolder.SubFolders
lncount = lncount + GetFolderCount(oFoldertmp.Path)
endfor
lncount = lncount + ofolder.SubFolders.Count
return lncount
And like George said, this could take awhile given that you could have a very large hard drive.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao