天涯之外

导航

ASP读取文件夹内的文件名并计算文件数量

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<%
'读取文件夹内的文件名病计算文件数量

c_path= server.MapPath("files")
set   file_system = createobject("scripting.filesystemobject")  
            set   cur_folder=file_system.getfolder(c_path)  
            '建立检索目录下的文件对象集合  
            set   sub_files=cur_folder.files  
            '遍历文件对象集合
            i=0
    
   for   each   each_file   in   sub_files
    if right(each_file.name,4) = ".jpg" or right(each_file.name,4) = ".gif" then
     i=i+1 
     name=each_file.name'取文件名
     names="[upload=jpg]UploadFile/2008-4qqface/"&name&"[/upload]<br>"
     response.write names 
    end if
            next  
            response.write i
   %>

 

 

</body>
</html>

posted on 2009-11-12 16:22  天涯之外  阅读(774)  评论(0编辑  收藏  举报