net C# 处理文件夹里的文件

            WriteCSVFile(users);

            string srcFileName = "order_" + DateTime.Now.ToString("yyyy-MM-dd") + ".csv";
            string tempFileName = "ordertemp_" + DateTime.Now.ToString("yyyy-MM-dd-ffff") + ".csv";

            try
            {
                string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "ordertemp_*.*");
                foreach (string file in files)
                {
                    File.Delete(file);  
                }
            }
            catch (Exception ex)
            {
                   // MessageBox.Show(ex.Message);
            }
            File.Copy(srcFileName, tempFileName, true);
            System.Diagnostics.Process.Start(tempFileName);

  

posted on 2019-03-21 16:20  前端一丁  阅读(71)  评论(0编辑  收藏  举报