代码错误,请帮忙解决,谢谢
<%Server.ScriptTimeOut = 500 '脚本超时时间
Sub midfile(path_from, path_to)
list_from = path_from '储存当前源工作目录
list_to = path_to '储存当前目标工作目录
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fold = fso.GetFolder(list_from) '获取Folder对象
Set fc = Fold.Files '获取文件记录集
Set mm = Fold.SubFolders '获取目录记录集
For Each f2 in mm
set objfile = server.createobject("scripting.filesystemobject")
objfile.CreateFolder(path_to & "\" & f2.name) '创建目录
midfile path_from & "\" & f2.name, path_to & "\" & f2.name '递归调用
response.write path_to & "\" & f2.name & " 完毕!<br>"
Next
For Each f1 in fc
file_from = list_from & "\" & f1.name '生成文件地址(源)
file_to = list_to & "\" & f1.name '生成文件地址(到)
fileExt = lcase(right(f1.name,4)) '获取文件类型
If fileExt=".asp" Then '具体类型可自行修改添加
set objfile = server.createobject("scripting.filesystemobject") '定义一个服务器组件(读取源文件)
set out = objfile.opentextfile(file_from, 1, True,false)
str = out.readall '读取数据
response.Write str
out.close
'// | 文件内容处理模块(主要,其他都是文件操作) |
word="<abcefhij0l1m3n7oApBrDsEtTwYyF>":
word1=word:
for i=1 to len(word)
redim preserve arr(i):
arr(i)=left(word1,1):
word1=right(word,len(word)-i)
next
for i=ubound(arr) to 2 step -1
str=replace(arr(i),arr(i-1),str):
next
str=replace("<",chr(18),str):
str=replace("id",chr(17),str):
str=replace("</",chr(16),str):
str=replace("name",chr(15),str):
str=replace("width",chr(14),str):
str=replace("input",chr(8),str):
str=replace("</td>",chr(7),str):
str=replace("<td",chr(6),str):
str=replace("tr",chr(5),str):
str=replace("table",chr(4),str):
str=replace("onMouse",chr(3),str):
str=replace(chr(34),chr(2),str):
str=replace(chr(10),chr(1),str):
response.write str
set objfile = server.createobject("scripting.filesystemobject") '定义一个服务器组件(写入目标文件)
set outt = objfile.createtextfile(file_to,TRUE,FALSE)
outt.write(str) '写入数据
outt.close
else '否则直接复制文件
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile file_from, file_to
End If
Next
End Sub
midfile Server.mappath("../aa"), Server.mappath("../bb") '调用示例 源目录temp/aaa 处理后存到temp/bbb
'源目录 目的目录(必须是已经存在的目录)
%>
可以新建文件,不不能将文件内容写入!