fso|xml| recursion
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= "Chinese Paladin 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 OneD The folders listed under IR in OBJASD
Strfdname=trim (onedir.name)
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 br> Onedirname=xml_format (onedir.name) ' & Escape
Objfxml.writeline ("<dir path=" "&OneDirName&" "" > "" Generates <dir path= "folder" ></DIR>
sdirname=dirname& "\ &onedir.name ' next recursive address
call Xml_ List (sdirname) ' calls recursive
Objfxml.writeline (' </DIR> ')
End If ' ending judgment
Next
Set objsf=objfs.files
Fo R each onefile in OBJSF ' list 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-corner & to &
Xml_format=strdirname
End Function
%>