用ASP将指定文件夹中的文件目录输出成XML文件
发布网友
发布时间:2023-05-05 11:10
我来回答
共1个回答
热心网友
时间:2023-11-10 05:54
<%
set fso=server.createobject("scripting.filesystemobject")
SongList="<?xml version=""1.0"" encoding=""utf-8""?>"&chr(13)&"<player showDisplay='yes' showPlaylist='yes' autoStart='no'>"
path="E:\mp3\"
set fd=fso.getfolder(path)
for each fi in fd.files
ext="mp3" '指定扩展名,留空则获取所有格式的文件
nlen=instrrev(fi.name,"."&ext)-1
if nlen>0 then SongList=SongList&chr(13)&"<song path=""/mp3/"&fi.name&""" title="""&left(fi.name,nlen)&"""/>"
next
set fout = fso.CreateTextFile(server.mappath("list.xml"),true,1)
fout.write SongList
fout.close
set fout=nothing
set fso=nothing
%>
热心网友
时间:2023-12-02 06:52
<%
set fso=server.createobject("scripting.filesystemobject")
SongList="<?xml version=""1.0"" encoding=""utf-8""?>"&chr(13)&"<player showDisplay='yes' showPlaylist='yes' autoStart='no'>"
path="E:\mp3\"
set fd=fso.getfolder(path)
for each fi in fd.files
ext="mp3" '指定扩展名,留空则获取所有格式的文件
nlen=instrrev(fi.name,"."&ext)-1
if nlen>0 then SongList=SongList&chr(13)&"<song path=""/mp3/"&fi.name&""" title="""&left(fi.name,nlen)&"""/>"
next
set fout = fso.CreateTextFile(server.mappath("list.xml"),true,1)
fout.write SongList
fout.close
set fout=nothing
set fso=nothing
%>