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創(chuàng)建文件夾
private void createFolder(string path)
{
if (!Directory.Exists(Server.MapPath(path)))
Directory.CreateDirectory(Server.MapPath(path));
}
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請
點擊舉報。