最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Directory类创建文件夹、删除文件夹。
时间:2022-06-30 10:48:51 编辑:袖梨 来源:一聚教程网
名字空间 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
{
///
/// myxml 的摘要说明。
///
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 {}
相关文章
- boss智能门锁如何设置密码 04-29
- 王者荣耀世界橘右京厉害吗 04-29
- 《青云劫攻略天赋技能,成就无敌仙侠》(解锁潜能,掌握绝学,成就仙侠传奇) 04-29
- 桃源深处有人家藏经室悟证一至七日通关答案 04-29
- 怎么击败《Saros》中的“破碎崛起”先知 Boss 04-29
- 宫小攻略技能推荐2023(玩转宫小,轻松游戏攻略指南) 04-29