利用fso顯示某一文件夾中的所有內容 <% '創建一個FileSystemObject對象的事例 Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject") path=server.mappath("./folder") '當前目錄下folder文件夾目錄 '創建一個Folder對象 Set MyFolder=MyFileObject.GetFolder(path) For Each thing in MyFolder.SubFolders '獲取子文件夾 response.write "<p>目錄:"&thing ' MyFileObject.DeleteFolder thing 刪除文件夾,注意使用 next '循環顯示其中文件 For Each thing in MyFolder.Files Response.Write("<p>文件:"&thing) '輸出文件路徑 'MyFileObject.DeleteFile thing '刪除這些文件,此刪除不可以恢復,需要小心使用 Next %>