首页 > Windows开发 > 详细

c# 备份数据

时间:2016-07-25 16:08:25      阅读:322      评论:0      收藏:0      [点我收藏+]
  #region 备份数据文件
        /// <summary>
        /// 备份数据文件
        /// </summary>
        /// <param name="strFileName">备份文件目录</param>
        /// <param name="strTypeKufen">发送还是接收</param>
        /// <param name="strMessageInfoType">消息类型</param>
        public void BackUpMessageInfo(String strFileName,String strTypeKufen,String strMessageInfoType)
        {
            if (File.Exists(strFileName))
            {
                string strPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BackUpMessageInfo");
                string strCombinPath = DateTime.Today.ToString("yyyy-MM-dd").ToString()
                    + "\\" + strTypeKufen.Trim() + "\\" + strMessageInfoType.Trim();

                strPath = Path.Combine(strPath, strCombinPath);
                if (!Directory.Exists(strPath))
                {
                    Directory.CreateDirectory(strPath);
                }

                #region delele northeasttycoon
                //if (!Directory.Exists(strPath))
                //{
                //    Directory.CreateDirectory(strPath);
                //}
                //strPath = Path.Combine(strPath, DateTime.Today.ToString("yyyy-MM-dd"));
                //if (!Directory.Exists(strPath))
                //{
                //    Directory.CreateDirectory(strPath);
                //}

                //strPath = Path.Combine(strPath, strTypeKufen.Trim());
                //if (!Directory.Exists(strPath))
                //{
                //    Directory.CreateDirectory(strPath);
                //}
                //strPath = Path.Combine(strPath, strMessageInfoType.Trim());
                //if (!Directory.Exists(strPath))
                //{
                //    Directory.CreateDirectory(strPath);
                //}
                #endregion delete northeasttycoon

                string strTempFile = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);
                strPath = Path.Combine(strPath, strTempFile);
                File.Copy(strFileName, strPath, true);
            }
        }
        #endregion 

 

c# 备份数据

原文:http://www.cnblogs.com/northeastTycoon/p/5703610.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!