Link to home
Start Free TrialLog in
Avatar of MayoorPatel
MayoorPatel

asked on

Parsing a folder full of .txt files and amending them with a URL from my DB.

Hi there I have a problem for which I am in need for help.

I have a database with a table that has a HTML tag list of all my domain names as follows

<A style="text-decoration:none" href="domainname.com.info">the</a>
<A style="text-decoration:none" href="domainname1.com.info">the</a>
<A style="text-decoration:none" href="domainname2.com.info">the</a>
.
.
.

I also have a folder on my server that has 40 .txt files which are articles written by myself. I need a piece of code which will loop through all the articles and replace the first occurence of the word "the" in the article with a link from the db.

Can someone provide me with an example of how this might be done in classic ASP?
Avatar of Joachim Carrein
Joachim Carrein
Flag of Belgium image

Hello MayoorPatel,

I did something similar for my photos. see snippet.

You can see i use the filesystemobject to run through all the files in a folder and make html of them.
in the html you can also add your string of the database.

Regards,

joachimcarrein
		set fso = server.CreateObject("Scripting.FileSystemObject")
		if fso.FolderExists(server.mappath("docs/photo/" & rsGallery("folder"))) then
			set fold = fso.getFolder(server.mappath("docs/photo/" & rsGallery("folder")))
			if fold.files.count <> 0 then getGallery = getGallery & "<div style=""width: 100%""><div id=""myGallery"">"
			for each fil in fold.files
				getGallery = Getgallery & "<div class=""imageElement"">"
				getGallery = Getgallery & "<h3>" & rsGallery("name") & "</h3>"
				getGallery = Getgallery & "<p></p>"
				getGallery = Getgallery & "<a href=""docs/photo/" & rsGallery("folder") & "/" & fil.name & """ style=""text-decoration:none;background: transparent;"" title=""open foto"" class=""open""></a>"
				getGallery = Getgallery & "<img src=""docs/photo/" & rsGallery("folder") & "/" & fil.name & """ class=""full"" />"
				getGallery = Getgallery & "</div>" & vbcrlf
			next
		else
			getGallery = getGallery & "<p><i>No pictures found</i></p>"
		end if
		set fso = nothing
		response.write getGallery

Open in new window

Avatar of MayoorPatel
MayoorPatel

ASKER

Sorry but my scripting skills are very weak, any chance you could provide an example of how I might accomplish this. I need to loop through every file in a folder called "articles", then access each file and replace the first occurence of the word "the" with a link from the db.
MayoorPatel,

i adjusted this code to loop through it, but i'm currently looking on updating the files themselves.

joachimcarrein
sFold = "/articles/"
set fso = server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(server.mappath(sFold)) then
	set fold = fso.getFolder(server.mappath(sFolder))
	for each fil in fold.files
		'Edit the file
	next
	response.write "Articles updated"	
else
	response.write "No articles found."
end if

Open in new window

joachimcarrein,

the snippet below should do such thing, i didn't program the change itself.

joachimcarrein
sFold = "/articles/"
set fso = server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(server.mappath(sFold)) then
	set fold = fso.getFolder(server.mappath(sFolder))
	for each fil in fold.files
		set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),1)
		sFile = f.ReadAll
		f.close 
		'update the first the in the sFile which is your article 
		set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),2)
		f.write sFile
		f.close
	next
	response.write "Articles updated"	
else
	response.write "No articles found."
end if
set fso = nothing

Open in new window

I can do the looping through the db and grabbing the URLS part if you can show me how to do the replacing part
if all the "the"s must be replace you can use the replace function, to only update the first "the" it should be something like the snippet
sToString = "<your url here>"
sFromString = "the"
if instr(sFile,sFromString) > 0 then
	sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
end if

Open in new window

joachimcarrein - It needs to be the first "the" only and then it moves onto the next article.
joachimcarrein,



joachimcarrein
sToString = "<your url here>"
sFromString = "the"
if instr(sFile,sFromString) > 0 then
      sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
end if

Open in new window

MayoorPatel,

did this resolve your problem?

joachimcarrein
Not yet I'm a bit stuck maybe you can help. Ive got this far so far. The problem is I need to grab 1 URL from the DB and insert it into the FIRST article, then grab the next URL and put it into the SECOND article and so on. Im having problems figuring out prgramitally how to do this.

I Currently have a nested loop which will grab a URL and then insert it into EVERY article, then grab another URL and insert that into EVERY article which is not what I want!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
 
<%
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd		
	.ActiveConnection = objConn
	.CommandText = "p_RetrieveURLS"
	.CommandType = adCmdStoredProc	
	Set objRSURLS = .Execute	
End With
Set adocmd = Nothing
 
Do Until objRSURLS.EOF
 
    sFold = "/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
	    set fold = fso.getFolder(server.mappath(sFolder))
	    for each fil in fold.files
		    set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),1)
		    sFile = f.ReadAll
		    f.close 
		    sToString = objRSURLS.Fields("url")
            sFromString = "the"
            if instr(sFile,sFromString) > 0 then
                  sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
            end if
		    set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),2)
		    f.write sFile
		    f.close
	    next
	    response.write "Articles updated"	
    else
	    response.write "No articles found."
    end if
    set fso = nothing
 
objRSURLS.MoveNext
Loop
objRSURLS.close
Set objRSURLS = Nothing
 
%>

Open in new window

MayoorPatel,

if you are sure there are as many lines as there are files, you don't even have to loop through you recordset.
while you get the next file, just get the next record, as seen below.

please notice there is no error handling in case there are less lines in the database than there are files. in that case you will get an EOF exception.

joachimcarrein
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
 
<%
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd            
      .ActiveConnection = objConn
      .CommandText = "p_RetrieveURLS"
      .CommandType = adCmdStoredProc      
      Set objRSURLS = .Execute      
End With
Set adocmd = Nothing
 
if not objRSURLS.EOF then
 
    sFold = "/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
          set fold = fso.getFolder(server.mappath(sFolder))
          for each fil in fold.files
                set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),1)
                sFile = f.ReadAll
                f.close 
                sToString = objRSURLS.Fields("url")
		sFromString = "the"
		if instr(sFile,sFromString) > 0 then
			sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
		end if
                set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),2)
                f.write sFile
                f.close
		objRSURLS.MoveNext
          next
          response.write "Articles updated"      
    else
          response.write "No articles found."
    end if
    set fso = nothing
 
end if
objRSURLS.close
Set objRSURLS = Nothing
 
%>

Open in new window

OK getting this error when I execute.

Server.MapPath() error 'ASP 0171 : 80004005'

Missing Path

/pastprojects/sprinkle.asp, line 26

The Path parameter must be specified for the MapPath method.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
<!-- #include file="includes/adovbs.inc" -->
 
<%
 
Dim adocmd, objRSURLS, sFold, fso, sfolder
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd            
      .ActiveConnection = objConn
      .CommandText = "p_RetrieveURLS"
      .CommandType = adCmdStoredProc      
      Set objRSURLS = .Execute      
End With
Set adocmd = Nothing
 
if not objRSURLS.EOF then
 
    sFold = "output/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
          set fold = fso.getFolder(server.mappath(sFolder))
          for each fil in fold.files
                set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),1)
                sFile = f.ReadAll
                f.close 
                sToString = objRSURLS.Fields("url")
		sFromString = "the"
		if instr(sFile,sFromString) > 0 then
			sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
		end if
                set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),2)
                f.write sFile
                f.close
		objRSURLS.MoveNext
          next
          response.write "Articles updated"      
    else
          response.write "No articles found."
    end if
    set fso = nothing
 
end if
objRSURLS.close
Set objRSURLS = Nothing
 
%>

Open in new window

MayoorPatel,

Hi, apparently, we were using both sFold and sFolder, in sFold there is the path, but in sFolder not, which means the functions gets an empty folder.
in the snippet i adjusted this.

joachimcarrein
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
<!-- #include file="includes/adovbs.inc" -->
 
<%
 
Dim adocmd, objRSURLS, sFold, fso
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd            
      .ActiveConnection = objConn
      .CommandText = "p_RetrieveURLS"
      .CommandType = adCmdStoredProc      
      Set objRSURLS = .Execute      
End With
Set adocmd = Nothing
 
if not objRSURLS.EOF then
 
    sFold = "output/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
          set fold = fso.getFolder(server.mappath(sFold))
          for each fil in fold.files
                set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),1)
                sFile = f.ReadAll
                f.close 
                sToString = objRSURLS.Fields("url")
            sFromString = "the"
            if instr(sFile,sFromString) > 0 then
                  sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
            end if
                set f=fso.OpenTextFile(server.Mappath(sPath & fil.name),2)
                f.write sFile
                f.close
            objRSURLS.MoveNext
          next
          response.write "Articles updated"      
    else
          response.write "No articles found."
    end if
    set fso = nothing
 
end if
objRSURLS.close
Set objRSURLS = Nothing
 
%>

Open in new window

OK its now getting file not found.

Microsoft VBScript runtime error '800a0035'

File not found

/pastprojects/sprinkle.asp, line 28
Also what does spath do and where is it defined?
sPath should become sFold, apparently, in the first post i made a mistake.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
<!-- #include file="includes/adovbs.inc" -->
 
<%
 
Dim adocmd, objRSURLS, sFold, fso
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd            
      .ActiveConnection = objConn
      .CommandText = "p_RetrieveURLS"
      .CommandType = adCmdStoredProc      
      Set objRSURLS = .Execute      
End With
Set adocmd = Nothing
 
if not objRSURLS.EOF then
 
    sFold = "output/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
          set fold = fso.getFolder(server.mappath(sFold))
          for each fil in fold.files
                set f=fso.OpenTextFile(server.Mappath(sFold & fil.name),1)
                sFile = f.ReadAll
                f.close 
                sToString = objRSURLS.Fields("url")
            sFromString = "the"
            if instr(sFile,sFromString) > 0 then
                  sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
            end if
                set f=fso.OpenTextFile(server.Mappath(sFold & fil.name),2)
                f.write sFile
                f.close
            objRSURLS.MoveNext
          next
          response.write "Articles updated"      
    else
          response.write "No articles found."
    end if
    set fso = nothing
 
end if
objRSURLS.close
Set objRSURLS = Nothing
 
%>

Open in new window

OK this code has mashed my text files. Its certainly doing something to them

here is the updated.
http://www.mayoor.co.uk/backyard_pondsUpdated.txt

here is the original
http://www.mayoor.co.uk/backyard_ponds.txt

Thanks for all your help so far. We're nearly there!

it says nothing found...
could you try this, and post here what it does?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
<!-- #include file="includes/adovbs.inc" -->
 
<%
 
Dim adocmd, objRSURLS, sFold, fso
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd            
      .ActiveConnection = objConn
      .CommandText = "p_RetrieveURLS"
      .CommandType = adCmdStoredProc      
      Set objRSURLS = .Execute      
End With
Set adocmd = Nothing
 
if not objRSURLS.EOF then
 
    sFold = "output/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
          set fold = fso.getFolder(server.mappath(sFold))
          for each fil in fold.files
                set f=fso.OpenTextFile(server.Mappath(sFold & fil.name),1)
                sFile = f.ReadAll
		response.write "<b>Before</b><br>" & sFile & "<br>"
                f.close 
                sToString = objRSURLS.Fields("url")
	    sFromString = "the"
            if instr(sFile,sFromString) > 0 then
                  sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
            end if
                set f=fso.OpenTextFile(server.Mappath(sFold & fil.name),2)
		response.write "<b>after</b><br>" & sFile & "<br>"
                f.write sFile
                f.close
            objRSURLS.MoveNext
          next
          response.write "Articles updated"      
    else
          response.write "No articles found."
    end if
    set fso = nothing
 
end if
objRSURLS.close
Set objRSURLS = Nothing
 
%>

Open in new window

This is what I get

Before
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþKafter
ÿþKBefore
ÿþK
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/pastprojects/sprinkle.asp, line 32
can you try the following snippet?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
 
<!-- #include file="includes/connection.asp" -->
<!-- #include file="includes/adovbs.inc" -->
 
<%
 
Dim adocmd, objRSURLS, sFold, fso
 
'Gather the checkboxes for the key Features
Set adocmd = Server.CreateObject("ADODB.Command")
With adocmd            
      .ActiveConnection = objConn
      .CommandText = "p_RetrieveURLS"
      .CommandType = adCmdStoredProc      
      Set objRSURLS = .Execute      
End With
Set adocmd = Nothing
 
if not objRSURLS.EOF then
 
    sFold = "output/articles/"
    set fso = server.CreateObject("Scripting.FileSystemObject")
    if fso.FolderExists(server.mappath(sFold)) then
          set fold = fso.getFolder(server.mappath(sFold))
          for each fil in fold.files
                sFile = FileLoad(server.Mappath(sFold & fil.name))
                sToString = objRSURLS.Fields("url")
	    sFromString = "the"
            if instr(sFile,sFromString) > 0 then
                  sFile = left(sFile,instr(sFile,sFromString)-1) & sToString & mid(sFile,instr(sFile,sFromString)+len(sFromString))
            end if
                set f=fso.OpenTextFile(server.Mappath(sFold & fil.name),2)
                f.write sFile
                f.close
            objRSURLS.MoveNext
          next
          response.write "Articles updated"      
    else
          response.write "No articles found."
    end if
    set fso = nothing
 
end if
objRSURLS.close
Set objRSURLS = Nothing
 
Function FileLoad(ByVal sFileName As String) As String
    Dim iFileNum As Integer, lFileLen As Long
 
    'Open File
    iFileNum = FreeFile
    'Read file
    Open sFileName For Binary Access Read As #iFileNum
    lFileLen = LOF(iFileNum)
    'Create output buffer
    FileLoad = String(lFileLen, " ")
    'Read contents of file
    Get iFileNum, 1, FileLoad
 
End Function
 
%>

Open in new window

forget this last one. this is not correct. i found this on a website. but it will not work. i rewriting it.
ASKER CERTIFIED SOLUTION
Avatar of Joachim Carrein
Joachim Carrein
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
unfortunately that is not workign either I get this when I look at a text file in that folder
Keyword: backyard ponds


Keyword Density: 8/1.84%


Games You Can Play In Your Backyard Ponds


                                                                                                                                                                                                                                                                   time to maintain your pond.  


First Off


                                                                                                                                                                                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                                                                                                                                                                                  olar powered pond filters available!   


                                                                                                                                                                                                                                                                                                                                                                                                  off at night. 


Let The Games Begin


Now that the water is healthy, here are some game games you can play with backyard ponds:


                                                                                                                                                                                                                                                                  s.

                                                                                                                                   
                                                                                                                                  ssible situations suggested by any plant, ripple or wildlife activity on the pond.  Dont knock it until youve tried it!


	

Open in new window

should work, i did the same here (except with the database data part)
i let the script change the to the2. and the file still looked ok here.

are those empty lines in it?
Well when I open the file there are loads of black squares non alphabetic characters. Just changed the bd code to replace with "the2" like you did and its doing the same thing. Ill upload the zip file of articles later so you can try with those and replicate exactly what im using for files.
can you also include the modified file from you side? with the black squares you say.
ok here are the original articles, should be 120 altogether.

http://www.mayoor.co.uk/lawn-care.zip
http://www.mayoor.co.uk/koi-ponds.zip
http://www.mayoor.co.uk/horse-riding.zip

try you code with these for now. Ill upload the resultant articles later
I think Ive fixed it!

I copied the contents of one of the text files and pasted it into another textfile and it did the replace with no problems at all!

All I need to do now is figure out a way of converting all those files to ANSI.
i thought it had something to do with a problem like "strange chars"

this should be a tool that does this:
http://juice.altiris.com/download/1956/convert-text-file-to-ansi
The tool has a wse extension, any ideas how I run this?
Fantastic, you've been absolutely marvelous! Thankyou for yoru continued efforts with this in producing a complete solution to this problem!
no problem, glad to here everything works :)
Avatar of RobSampson
Hi, are you still having issues with this, or is it finished now?

Regards,

Rob.
it's finished. my first routine worked, only the ASP didn't know how to handle the unicode or so. with converting the files to normal ansi, the routine worked perfectly.