5-5.asp

来自「ASP入门与提高实用教程 源文件(上传网站)」· ASP 代码 · 共 26 行

ASP
26
字号
<html>
<head>
    <title>显示指定文件夹下所有的子文件夹和文件</title>
</head>
<body>
	<%
	Dim myFileObject                         '定义一个FileSystemObject对象实例
	Dim myFolder                              '定义一个Folder对象
	Set myFileObject=Server.CreateObject("Scripting.FileSystemObject")
	'GetFolder方法将返回一个Folder对象
	Set myFolder=myFileObject.GetFolder("F:\inetpub\wwwroot")
	Response.Write "<b>F:\inetpub\wwwroot子文件夹如下:</b><br>"
	'显示F:\inetpub\wwwroot下的子文件夹
	For Each Item In myFolder.SubFolders
		Response.Write Item & "<br>"
	Next
	
		Response.Write "<p>" & "<b>F:\inetpub\wwwroot子文件如下:</b><br>"
	'显示F:\inetpub\wwwroot下的文件
	For Each Item In myFolder.Files
		Response.Write Item & "<br>"
	Next
	%>
</body> 
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?