LeavingMe.net

C# 隐藏文件夹

2008-04-22 21:05:00

using System; using System.IO; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class getDirectory : System.Web.UI.Page {     protected void Page_Load(object sender, EventArgs e)     {         string path = Request.QueryString["path"];         if(path == null || path == "")             path = @"C:\Windows";                DirectoryInfo TheFolder = new DirectoryInfo(path);         if (!TheFolder.Exists)             throw new DirectoryNotFoundException("Folder not found: " + path);         string info = "<?xml version=\"1.0\"?><tree>";         foreach (DirectoryInfo NextFolder in TheFolder.GetDirectories())         {             //判读是否是隐藏文件夹             if(NextFolder.Attributes.ToString().IndexOf("Hidden"== -1)                 info += "<tree text=\"" + NextFolder.Name + "\" src=\"" + NextFolder.FullName + "\"/>";         }         info += "</tree>";         Response.Clear();         Response.ContentType="text/xml";         Response.Charset="UTF-8";         Response.Write(info);         Response.End();     } }

[陈源](http://leavingme.cnblogs.com/) 2008-04-22 21:05 [发表评论](http://www.cnblogs.com/leavingme/archive/2008/04/22/1166219.html#Feedback)
comments powered by Disqus