JuniperGreen
Member
As a newbie I am struggling to write a VBS script and would appreciate some help. I have searched through previous queries but couldn't find anything to match this:
I have directory with a fair number of files in it and wish to write a VBS script which will go through all the files in the directory and copy the first line of each of the files and append each first line to a list in an output file.
I have made a start but am at a loss how to proceed to write the info to the output file
Any help or script would be greatly appreciated.
JuniperGreen
"Script:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set folder = objFSO.GetFolder("c:\library\")
Set outfile = objFSO.CreateTextFile("c:\library2\Reference.txt")
for each file in folder.Files
Set testfile = objFSO.OpenTextFile(file.path, ForReading)
Do While Not testfile.AtEndOfStream
StrLine = testfile.ReadLine
Loop
Testfile.close
Set testfile = nothing
Next
Outfile.close"
I have directory with a fair number of files in it and wish to write a VBS script which will go through all the files in the directory and copy the first line of each of the files and append each first line to a list in an output file.
I have made a start but am at a loss how to proceed to write the info to the output file
Any help or script would be greatly appreciated.
JuniperGreen
"Script:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set folder = objFSO.GetFolder("c:\library\")
Set outfile = objFSO.CreateTextFile("c:\library2\Reference.txt")
for each file in folder.Files
Set testfile = objFSO.OpenTextFile(file.path, ForReading)
Do While Not testfile.AtEndOfStream
StrLine = testfile.ReadLine
Loop
Testfile.close
Set testfile = nothing
Next
Outfile.close"