I think something like that is more suited to vbScript than VB. The following script takes 2 arguments, infile and outfile. Infile contains the unfiltered dictionary (one word per line). Outfile is the file to contain the filtered words (will be created if it does not exist). Here is the code
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
set fso = CreateObject("Scripting.FileSystemObject")
set arg = Wscript.Arguments
if arg.Count <> 2 Then
wscript.Echo "delete5 infile outfile"
wscript.Quit
end if
if Not fso.FileExists(arg(0)) then
wscript.Echo "file",arg(0),"not found"
wscript.Quit
end if
set tsoin = fso.OpenTextFile(arg(0),ForReading)
set tsoout = fso.OpenTextFile(arg(1),ForWriting,True)
do until tsoin.AtEndOfStream
line = Trim(tsoin.ReadLine)
if Len(line) > 5 Then
tsoout.WriteLine(line)
end if
loop
tsoin.Close()
tsoout.Close() Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159