I did some more research and split my script into a Sub Main and a Sub Count for this counting files issue. This seems to run fine, however I cannot get the variables to move from sub to sub.
I edited out all of the parts that dont pertain to this for testing, so its only the counting that I am working with.
mydocsSubFolderCount = 0
For Each mydocsSubFolder in mydocsFolder.SubFolders
LogStream.WriteLine(LogStamp & mydocsSubFolderFiles)
This is the loop that goes through the subfolders of the parent directory, calling my count sub, and when the count sub ends it returns and is supposed to send the number to my log file, but it only returns a blank. I am assuming this is because the variable is cleared when the sub ends, and since this is VBScript and not a full program, there is no place for me to define a public variable?
Sub Count(ByRef mydocsSubFolder)
cCount = mydocsSubFolder.Files.Count
mydocsSubFolderFiles = mydocsSubFolderFiles + cCount
cCount = 0
For Each mydocsSubFolder in mydocsSubFolder.SubFolders