Hello,
This is my first attempt at writing something in VBScript.
I have some code that searches a location on the network and outputs all files ending with a certain extension. The output is written to a .htm file. What I would like to happen is for the output to contain links to the documents located on the network. Could anyone advise?Here is a sample of the code that I'm using.
...ecm
Dim objFSO
Dim ofolder
Dim objStream
Set objFSO = CreateObject("scripting.filesystemobject")
'create the output file
Set objStream = objFSO.createtextfile("K:\orkand\DAEBTools\TSASearch.htm",True)
CheckFolder (objFSO.getfolder("I:\CABINETS\TSB\TSAREPORT\")), objStream
MsgBox "File Search Completed." + vbCr + "Please check."
Sub CheckFolder(objCurrentFolder, objLogFile)
Dim strTemp
Dim strSearch
Dim strOutput
Dim objNewFolder
Dim objFile
Dim objStream
strSearch = ".pdf"
For Each objFile In objCurrentFolder.Files
strTemp = Right(objFile.Name,4)
If UCase(strTemp) = UCase(strSearch) Then
strOutput = CStr(objFile.Path) _
+ "," + chr(32) + CStr(objFile.Size) _
+ "," + chr(32) + CStr(objFile.Type) + "," _
+ chr(32) +CStr(objFile.datelastaccessed)
objLogFile.writeline strOutput
End If
Next
For Each objNewFolder In objCurrentFolder.subFolders
CheckFolder objNewFolder, objLogFile
Next
End Sub
This is my first attempt at writing something in VBScript.
I have some code that searches a location on the network and outputs all files ending with a certain extension. The output is written to a .htm file. What I would like to happen is for the output to contain links to the documents located on the network. Could anyone advise?Here is a sample of the code that I'm using.
...ecm
Dim objFSO
Dim ofolder
Dim objStream
Set objFSO = CreateObject("scripting.filesystemobject")
'create the output file
Set objStream = objFSO.createtextfile("K:\orkand\DAEBTools\TSASearch.htm",True)
CheckFolder (objFSO.getfolder("I:\CABINETS\TSB\TSAREPORT\")), objStream
MsgBox "File Search Completed." + vbCr + "Please check."
Sub CheckFolder(objCurrentFolder, objLogFile)
Dim strTemp
Dim strSearch
Dim strOutput
Dim objNewFolder
Dim objFile
Dim objStream
strSearch = ".pdf"
For Each objFile In objCurrentFolder.Files
strTemp = Right(objFile.Name,4)
If UCase(strTemp) = UCase(strSearch) Then
strOutput = CStr(objFile.Path) _
+ "," + chr(32) + CStr(objFile.Size) _
+ "," + chr(32) + CStr(objFile.Type) + "," _
+ chr(32) +CStr(objFile.datelastaccessed)
objLogFile.writeline strOutput
End If
Next
For Each objNewFolder In objCurrentFolder.subFolders
CheckFolder objNewFolder, objLogFile
Next
End Sub