The following script should work
Dim dt
dt=now
Dim fn
fn = "vb" & Lpad(day(dt), "0", 2) & "/" & Lpad(month(dt), "0", 2) & "/" & year(dt)
Set fso = CreateObject("Scripting.FileSystemObject")
foldername = "c:\temp"
If fso.FileExists(fso.BuildPath(foldername, fn)) Then
WScript.Echo fn & " exists in " & foldername
else
WScript.Echo fn & " not found"
End If
Function Lpad (MyValue, MyPadCharacter, MyPaddedLength)
Dim x
Dim PadLength
Padlength = MyPaddedLength - Len(MyValue)
Dim PadString
For x = 1 To Padlength
PadString = PadString & MyPadCharacter
Next
Lpad = PadString & MyValue
End Function
Points to note:
- I had to remove the "/" to test this as I'm working in a windows environment and that character is not legal in filenames
- I've used the day,month, year VBScript functions to force the date (in the file name) to always be the format I expect (rather than using date formatting which could differ depending on culture)
- I've padded the day and month with leading zeroes for consistency of naming - the requirement was implied by your use of
/02/
- The function from M$ (See reference link in the code) didn't work so I changed the
+
to a
&
(string concatenator)