% dim fso,objFolder,objFiles dim filelist Set fso=Server.CreateObject("scripting.FileSystemObject") Set objFolder=fso.GetFolder(server.MapPath("thumbs")) Set objFiles=objFolder.Files '循環(huán)輸出文件夾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%>