using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
namespace TEST
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{//打开文件夹
            //    //if (Request.QueryString["id"] == null)
            //    //{ }
            //    //else
            //    //{
            //    //    string rpath = Server.UrlDecode(Request.QueryString["id"]);
                   
            //    //}
                
            //    string path = Server.MapPath(".");
            
            //    string sPath = path+@"\1222";//定义一个路径 
            //    Label1.Text = sPath;
            //    if (!Directory.Exists(sPath))
            //    {
            //        Directory.CreateDirectory(sPath);
                  
            //    } 
            //    //C#删除文件 
            //    string delFile = sPath + "\\myText.HTML"; 
            //    File.Delete(delFile);
            //    // C#追加文件             //    StreamWriter sw = File.AppendText(sPath + "\\myText.HTML");
            //    TextBox1.Text = "<html><head><title>无标题文档</title></head><body>到访</body></html>";
            //    sw.WriteLine(TextBox1.Text);
            //    //sw.WriteLine("kzlll");
            //    //sw.WriteLine(".NET笔记");
            //    sw.Flush();
            //    sw.Close();
            //    ////C#拷贝文件 
            //    string OrignFile, NewFile;
            //    OrignFile = sPath + "\\myText.HTML";
            //    NewFile = sPath + "\\myTextCopy.html";
            //    File.Copy(OrignFile, NewFile, true);
                
            //}
        }        protected void Button1_Click(object sender, EventArgs e)
        {
            string path = Server.MapPath(".");
            string url = path+"\\"+1222;
            //Response.Write("Default.aspx?id="+url);
            //---------
            DirectoryInfo drct = new DirectoryInfo(url);
            foreach(FileSystemInfo fsi in drct.GetFileSystemInfos()){
                if (fsi is FileInfo)
                {  
                    //文件   
                   FileInfo  fi = (FileInfo)fsi;   
                }    
                else{       //文件夹 
                    drct = (DirectoryInfo)fsi;
                } 
            }
        }
    }
}