Hi all, complete noob to vb.
OK.. so I have this. It does great at counting the number of files in c:\temp and it's subfolders. But it pops it up in a msgbox.
What I really need is something that will
a) read a list of remote computers (e.g., c:\servers.txt)
b) count the files in a folder (and subfolders) e.g., c:\temp
c)output all of this to a text file (output.txt) thusly
Server Number of Files
LukeSky 12
DarthV 9
HansSolo 27
PrincessL 4
etc etc.. here is what I'm starting with.. obviously, I don't know what I'm doing. Any help appreciated.
OK.. so I have this. It does great at counting the number of files in c:\temp and it's subfolders. But it pops it up in a msgbox.
What I really need is something that will
a) read a list of remote computers (e.g., c:\servers.txt)
b) count the files in a folder (and subfolders) e.g., c:\temp
c)output all of this to a text file (output.txt) thusly
Server Number of Files
LukeSky 12
DarthV 9
HansSolo 27
PrincessL 4
etc etc.. here is what I'm starting with.. obviously, I don't know what I'm doing. Any help appreciated.
Code:
Option Explicit
dim fs, a
Set fs = CreateObject("scripting.filesystemobject")
' count files in temp directory
Msgbox CountFiles ("c:\temp")
Function CountFiles (ByVal StrFolder)
Dim ParentFld
Dim SubFld
Dim IntCount
Set ParentFld = fs.GetFolder (StrFolder)
IntCount = ParentFld.Files.Count
For Each SubFld In ParentFld.SubFolders
IntCount = IntCount + CountFiles(SubFld.Path)
Next
Countfiles = IntCount
End Function