I've been using QTP for a wee while but now I need to do something I've not been asked to before...
How to count the number of files in a particular folder. The names of the files will be unknown, but the folder name will be constant.
I know this sounds very simple and using other tools (SilkTest for example) it is indeed fairly simple but I cannot find anything in QTP that can do this!
Can anyone offer some advice on this, or if I'm just missing the bleeding obvious point me in the right direction.
Have you looked at the FSO (File System Object[sic]))?
Yep, FSO is the way to go...
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
s = fc.count
FileCount = s
A good rule of thumb is to never measure with your thumb.