Simple .NET script to list all of the .swf files in a folder as XML

Here is some handy code for if you have a bunch of .swf files and you need to get some XML to load them into flash. It should also totally be easy to change the script to list any file type you need enumerated.

<%@ Page ContentType="text/xml" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.IO" %>
<script language="C#" runat="server">
	void Page_Load(object sender, System.EventArgs e) {
		XmlWriter writer = XmlWriter.Create(Response.OutputStream);
		DirectoryInfo di = new DirectoryInfo(Server.MapPath(""));
		FileInfo[] files = di.GetFiles("*.swf");
		foreach(FileInfo fi in files) {
			writer.WriteAttributeString("name", fi.Name);

This will output something like:

<?xml version="1.0" encoding="utf-8"?>
    <movie name="scene_001.swf"/>
    <movie name="scene_002.swf"/>
    <movie name="scene_003.swf"/>
    <movie name="scene_004.swf"/>
    <movie name="scene_005.swf"/>
    <movie name="scene_006.swf"/>