最新下载
热门教程
- 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 {}
相关文章
- 《航海王壮志雄心》加工台升级什么方法较适用 06-16
- 如何入手LUMIA币?2025OKX交易所零门槛指南 06-16
- 《世界启元》S10赛季威廉明娜肉队推荐 06-16
- 《世界启元》S10赛季威廉明娜速攻队推荐 06-16
- 《雷霆战机集结》巡航模式攻略 06-16
- 《雷霆战机集结》装备/驾驶员/源晶养成攻略 06-16