复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%OptionExplicit%>
<%OnErrorResumeNext%>
<% Response.Charset="UTF-8"%>
<% Server.ScriptTimeout=99999999%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>
<title>文件打包程序</title>
</head>
<body>
<%
Dim ZipPathDir, ZipPathFile
Dim startime, endtime
'在此更改要打包文件夹的路径
ZipPathDir ="F:\www.yongfa365.com"'
ZipPathFile ="update.xml"
If Right(ZipPathDir,1)<>"\"Then ZipPathDir = ZipPathDir&"\"
'开始打包
CreateXml(ZipPathFile)
'遍历目录内的所有文件以及文件夹
Sub LoadData(DirPath)
Dim XmlDoc
Dim fso 'fso对象
Dim objFolder '文件夹对象
Dim objSubFolders '子文件夹集合
Dim objSubFolder '子文件夹对象
Dim objFiles '文件集合
Dim objFile '文件对象
Dim objStream
Dim pathname, TextStream, pp, Xfolder, Xfpath, Xfile, Xpath, Xstream
Dim PathNameStr
response.Write("=========="&DirPath&"==========<br>")
Set fso = server.CreateObject("scripting.filesystemobject")
Set objFolder = fso.GetFolder(DirPath)'创建文件夹对象
Response.Write DirPath
Response.flush
Set XmlDoc = Server.CreateObject("Microsoft.XMLDOM")
XmlDoc.load Server.MapPath(ZipPathFile)
XmlDoc.async =False
'写入每个文件夹路径
Set Xfolder = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("folder"))
Set Xfpath = Xfolder.AppendChild(XmlDoc.CreateElement("path"))
Xfpath.text = Replace(DirPath, ZipPathDir,"")
Set objFiles = objFolder.Files
ForEach objFile in objFiles
If LCase(DirPath & objFile.Name)<> LCase(Request.ServerVariables("PATH_TRANSLATED"))Then
内容版权声明:除非注明,否则皆为本站原创文章。