.Net文件操作--赋值、粘贴、删除
来源:互联网 发布:Matlab数据精度 编辑:程序博客网 时间:2024/06/05 20:18
1、.net删除文件或者文件夹(文件夹以"\"结尾)
public static bool FilePicDelete(string path)
{
bool ret = false;
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
file.Delete();
ret = true;
}
return ret;
}
2、.net复制文件
public void copyFile(string ObjectFile,String SourceFile )
{
string sourceFile = Server.MapPath(SourceFile);
string objectFile = Server.MapPath(ObjectFile);
if (System.IO.File.Exists(sourceFile))
{
System.IO.File.Copy(sourceFile, objectFile, true);
}
}
3、.net创建文件夹
private void createFolder(string path)
{
if (!Directory.Exists(Server.MapPath(path)))
Directory.CreateDirectory(Server.MapPath(path));
}
public static bool FilePicDelete(string path)
{
bool ret = false;
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
file.Delete();
ret = true;
}
return ret;
}
2、.net复制文件
public void copyFile(string ObjectFile,String SourceFile )
{
string sourceFile = Server.MapPath(SourceFile);
string objectFile = Server.MapPath(ObjectFile);
if (System.IO.File.Exists(sourceFile))
{
System.IO.File.Copy(sourceFile, objectFile, true);
}
}
3、.net创建文件夹
private void createFolder(string path)
{
if (!Directory.Exists(Server.MapPath(path)))
Directory.CreateDirectory(Server.MapPath(path));
}
- .Net文件操作--赋值、粘贴、删除
- asp.net文件的,创建,删除,复制,粘贴
- asp.net文件的,创建,删除,复制,粘贴
- (集合)JAVA文件操作--复制、粘贴、删除、剪切
- .NET操作XML文件---[删除]
- 文件移动、复制、粘贴、删除
- .net 文件操作移动复制删除等
- .net 文件操作移动复制删除等
- vi基本操作(4) -- 复制、粘贴、删除及范围操作
- iOS 实现赋值粘贴
- .net 对xml文件的读写,添加,修改,删除操作
- ASP.Net 删除xml文件中的数据(delete操作)
- ASP.NET操作XML文件---增加、修改、删除、显示
- .net操作xml文件(新增.修改,删除,读取)
- .net操作xml文件(新增.修改,删除,读取)
- .net操作xml文件(新增.修改,删除,读取)
- net,C#,Ftp各种操作,上传,下载,删除文件,创建目录,删除目录,获得文件列表
- .net,C#,Ftp各种操作,上传,下载,删除文件,创建目录,删除目录,获得文件列表...
- 360、腾讯、迅雷Windows编程、网络编程面试题及答案
- LAMP环境搭建ECMALL网上商城
- 17、有一个由大小写组成的字符串,现在需要对他进行修改, 将其中的所有小写字母排在答谢字母的前面(大写或小写字母之间不要求保持原来次序)
- 一致性哈希算法(腾讯笔试题附加题)
- 可变参数表函数的原理及实现(printf实现)
- .Net文件操作--赋值、粘贴、删除
- 经典网络游戏服务器架构
- ALV报表代码自动生成器--懒汉有救了
- 主要nosql数据库对比
- 建站心得
- ivy教程(2)-快速开始
- pthread线程同步机制
- Linux网络编程一步一步学-select详解
- 200行C代码实现简单线程池