最新下载
热门教程
- 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 {}
相关文章
- 超星学生登录入口-超星通官网网页版登录 10-28
- yandex官网登录入口-yandex国际版登录入口 10-28
- 麻花豆国产剧高清在线播放-麻花豆国产剧畅享免费mv 10-28
- 漫蛙漫画官方入口-漫蛙漫画在线免费观看官网 10-27
- poki小游戏在线入口-poki免费游戏大全 10-27
- 豆包网页版入口官网-豆包官网网址入口 10-27