tomt

I have the following vbscript that works if I place the script inside the directory folder of text files and run it from there. It merges all text files into one text file.

Set fso = CreateObject("Scripting.FileSystemObject"Applause
set mainfolder=fso.GetFolder("."Applause
Set filecollection = mainfolder.Files


Set objfileOut=fso.OpenTextFile ("merged.txt",2,true)
init=false


For Each fileList In filecollection
  If fso.GetExtensionName(fileList.Path)="txt" Then
    Set objfileRead=fileList.OpenAsTextStream(1)
    objfileOut.Write  VBCRLF & "<file>" & VBCRLF
    objfileOut.Write  "<filename>" & fileList.name & "</filename>" & VBCRLF
    objfileOut.Write  VBCRLF & "<article>" & VBCRLF
    objfileOut.Write objfileRead.ReadAll
    objfileOut.Write  VBCRLF & "</article>" & VBCRLF
    objfileOut.Write  VBCRLF & "</file>" & VBCRLF
    objfileRead.Close
  End If
Next

I am trying to make a windows form in vb

.net

  to do the same thing. I am using FolderBrowserDialog to get the directory folder. I can't get the vbscript converted correctly. Any help would be appreciated.

Thanks,
Tom

tomt

Update.

Between my son, who knows vb

.net

  100 times better than me, and Google, I got the code rewrote and it works.

Tom



perkiset

Right on... and what a cool and humorous place to resource.

Please invite your son to join us here ... Applause

/p

tomt

Shawn is more into game

programming

 .

Tom


Perkiset's Place Home   Politics @ Perkiset's