.Net文件操作--赋值、粘贴、删除

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));     }
posted @ 2013-01-07 21:37  程序有Bug  阅读(468)  评论(0编辑  收藏  举报