我们这里通过遍历一个文件夹下的文件来生成一个sitemap.txt文件,代码如下:
<%
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fsd=fso.getfolder(server.mappath("../test/"))
Set fs=fso.openTextFile(Server.mappath("/sitemap.txt"),8,true)
Set fsfiles=fsd.Files
For Each fsfile In fsfiles
tmpPath="http://www.test.com/test/" & fsFile.name
fs.writeLine tmpPath
Next
response.write "<p>Create Sitemap.txt Successfully !"
set fsfiles=nothing
set fs=nothing
set fsd=nothing
set fso=nothing
%>