% dim fso,objFolder,objFiles dim filelist Set fso=Server.CreateObject("scripting.FileSystemObject") Set objFolder=fso.GetFolder(server.MapPath("thumbs")) Set objFiles=objFolder.Files '循环输出文件夹path下的文件的文件名 For each objFile in objFiles If getExt(objFile.name)="gif" or getExt(objFile.name)="jpg" or getExt(objFile.name)="jpeg" Then filelist = filelist"img src="""objFile.name""">" End If Next
'释放对象 Set objFolder=nothing Set fso=nothing '获取文件类型 Function getExt(str) getExt = Lcase(Right(str,Len(str)-InstrRev(str,"."))) End Function %> %=filelist%>