Originally, this XML document was generated to develop an ftp search, but later, since there was no information reference to how to search for the XML document, I gave up. The most important one was the recursive algorithm. The speed of generating file lists was very fast. This program can be used to generate playlists and other things. It requires support from IIS's FSO component. Generate XML documents similar to the following
<?xml version=1.0 encoding=gb2312?>
<ftp ip=10.1.228.228>
<DIR path=Game>
<DIR path=Legend of Sword and Fairy 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 Zuiyu Wutong All rights reserved. ##'
'## Powered by Drunk Rain Wutong##'
'## http://btyz.51web.cn/ ##'
'## [email protected] ##'
'##########################################################'
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!) 'The list succeeds
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 strFdName<>System Volume Information Then
OneDirName=xml_format(OneDir.Name) 'Escape&
objFxml.WriteLine(<DIR path=&OneDirName&>) 'Generate <DIR path=folder></DIR>
SDirName=DirName&/&OneDir.Name 'Next recursive address
Call xml_list(SDirName) 'Call recursion
objFxml.WriteLine(</DIR>)
End If 'End Judgment
Next
set objSF=objFS.Files
For Each OneFile in objSF 'List the files
objFxml.WriteLine(<file size=&OneFile.size&>&OneFile.Name&</file>) 'Generate <file>filename</file>
Next
End Function
'Remove characters that are not allowed by XML
Function xml_format(strDirName)
strDirName=Replace(strDirName,&,&) 'Convert half of the & into &
xml_format=strDirName
End Function