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));
}