欢迎光临
我们一直在努力

Directory类创建文件夹、删除文件夹。-ASP教程,数据库相关

建站超值云服务器,限时71元/月

 

名字空间 system.io
using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;
using system.text;
using system.io;
namespace new_app
{
 /// <summary>
 /// myxml 的摘要说明。
 /// </summary>
 public class myxml : system.web.ui.page
 {
  private const string cdanme = “d:\\mydir”;
  private void page_load(object sender, system.eventargs e)
  {
   // 在此处放置用户代码以初始化页面  

   my_createdirectory (cdanme);

  }
  public void my_createdirectory (string path)
  {
   try
   {
    // 检查目录是否存在
    if (directory.exists(path))
    {
     response.write(“目录已经存在.”);
     return;
    }

    // 创建目录
    directoryinfo di = directory.createdirectory(path);
    response.write(“目录应创建成功”);

    // 删除目录
    //di.delete();
    //console.writeline(“目录已经删除.”);
   }
   catch (exception e)
   {
    response.write(“出现异常”);
   }
   finally {}

  }  
  #region web 窗体设计器生成的代码
  override protected void oninit(eventargs e)
  {
   //
   // codegen: 该调用是 asp.net web 窗体设计器所必需的。
   //
   initializecomponent();
   base.oninit(e);
  }
  
  /// <summary>
  /// 设计器支持所需的方法 – 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void initializecomponent()
  {   
   this.load += new system.eventhandler(this.page_load);
  }
  #endregion
 }
}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Directory类创建文件夹、删除文件夹。-ASP教程,数据库相关
分享到: 更多 (0)