This XML document was originally generated to develop an FTP search, and later because there was no data reference to how to search for XML documents, and give up. The most important of these is the recursive algorithm. The file list is generated quickly. This program can be used to generate playlists and things like that. Require the FSO component support for IIS. Generate an XML document similar to the following
<?xml version="1.0" encoding="gb2312"?>
<ftp ip="10.1.228.228">
<DIR path="Game">
<DIR path="仙剑奇侠传2(save)">
<file size="346294">complete_camel.rar</file>
<file size="1886286">complete_funlove.rar</file>
</DIR>
</DIR>
</ftp>
Make_file_list.asp
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%
'######################################'
' # # Copyright (C) 2003 Drunk Rain Indus All rights reserved. ##'
' # # Powered by Drunk Rain Indus # '
' # # http://btyz.51web.cn/# #
' # # winterfire@163.com # #
'######################################'
Dim Objfo,objf,objaf,objfxml
Set Objfo=createobject ("Scripting.FileSystemObject") ' Object
Set Objfxml=objfo.opentextfile ("G:\My documents\http\personal works\ftp_search\ftp.xml", 2) ' Open file
Objfxml.writeline ("<?xml version=" "1.0" "encoding=" "gb2312" "?>")
Objfxml.writeline ("<ftp ip=" "10.1.228.228" ">")
Call Xml_list ("f:\") ' Start list
Objfxml.writeline ("</ftp>")
Response.Write ("List is ok!") List successful
Function xml_list (dirname)
Set Objfs=objfo.getfolder (dirname)
Set Objasd=objfs.subfolders
For each onedir in OBJASD
Strfdname=trim (Onedir.name)
' The folders listed below are not generated in the list (System files or hidden files)
If strfdname<> "Config.msi" EQV strfdname<> "recycled" EQV strfdname<> "RECYCLER" EQV > "System Volume Information" Then
Onedirname=xml_format (Onedir.name) ' Escapes &
Objfxml.writeline ("<dir path=" "&OneDirName&" ">") ' Generate <dir path= folder ' ></DIR>
sdirname=dirname& "\" &onedir.name ' next recursive address
Call Xml_list (sdirname) ' calls recursion
Objfxml.writeline ("</DIR>")
End If ' Ending judgment
Next
Set Objsf=objfs.files
For each onefile in OBJSF ' list files
Objfxml.writeline ("<file size=" "&OneFile.size&" ">" &OneFile.Name& "</file>") ' Generate < file> file name </file>
Next
End Function
' Remove characters that are not allowed by XML
Function Xml_format (strDirName)
Strdirname=replace (strDirName, "&", "&") ' Convert the & of Half-width to &
Xml_format=strdirname
End Function
%>