Question : Script for counting files in a directory

I need a simple vbs script to count the numver of files staring with QUA created the day the script is run

This then need to be in a variable that I can use in the rest of my script

Answer : Script for counting files in a directory

For a specific folder?

If so, you could try something like this (strCount is the resulting variable):


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = "C:\Temp"

Set objFolder = fso.GetFolder(strFolder)
Set objFiles = objFolder.Files

strCount = 0

For each objFile in objFiles
If Ucase(Left(objFile.Name, 3)) = "QUA" Then
Result = DateDiff("d", Date, objFile.DateCreated)
	If Result = 0 then
	strCount = strCount + 1
	End If
End If
Next

Wscript.Echo strCount
Random Solutions  
 
programming4us programming4us