Hi everyone, I'm new on here and quiet recently new to VBScript.
I have the following code which is used to find a file in a directory.
I need to modify it so that when it finds the file it will E-mail it to me as an attachment. Is this possible, any help would be much appreciated.
Thanks in advance.
<code>
Const startDir = "C:\Documents and Settings\2336178\Desktop\Previous"
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFileName = "index.css"
Set oFolder = oFSO.GetFolder(startDir)
Recurse(oFolder)
Sub Recurse(oFldr)
If IsAccessible(oFolder) Then
For Each oSubFolder In oFldr.SubFolders
Recurse oSubFolder
Next
For Each oFile In oFldr.Files
If LCase(oFile.Name) = sFileName Then WScript.Echo sFileName, "exists."
Next
End If
End Sub
Function IsAccessible(oFolder)
On Error Resume Next
IsAccessible = (oFolder.SubFolders.Count >= 0)
End Function
</code>
I have the following code which is used to find a file in a directory.
I need to modify it so that when it finds the file it will E-mail it to me as an attachment. Is this possible, any help would be much appreciated.
Thanks in advance.
<code>
Const startDir = "C:\Documents and Settings\2336178\Desktop\Previous"
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFileName = "index.css"
Set oFolder = oFSO.GetFolder(startDir)
Recurse(oFolder)
Sub Recurse(oFldr)
If IsAccessible(oFolder) Then
For Each oSubFolder In oFldr.SubFolders
Recurse oSubFolder
Next
For Each oFile In oFldr.Files
If LCase(oFile.Name) = sFileName Then WScript.Echo sFileName, "exists."
Next
End If
End Sub
Function IsAccessible(oFolder)
On Error Resume Next
IsAccessible = (oFolder.SubFolders.Count >= 0)
End Function
</code>