最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#獲取指定目錄下指定文件的方法

 更新時間:2022年04月14日 12:59:52   作者:農(nóng)碼一生  
這篇文章介紹了C#獲取指定目錄下指定文件的方法,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

1.首先,需要指定獲取的文件夾,以及獲取文件的文件名;

文件夾:strLocalPath = System.Windows.Forms.Application.StartupPath + "\\ExcelTemplate\\";

文件名:temp.xlsx

2.代碼:

ExecutionResult result = new ExecutionResult();
 result.Status = true;
 string strLocalPath = System.Windows.Forms.Application.StartupPath + "\\ExcelTemplate\\";
 if (Directory.Exists(strLocalPath))
 {
 foreach (string GCFile in Directory.GetFiles(strLocalPath, "temp.xlsx", SearchOption.TopDirectoryOnly))
    {
   string fileName = Path.GetFileName(GCFile);
   string filename = Path.GetFileName(GCFile).Replace(".xlsx", "") + DateTime.Now.ToString("_yyyyMMdd") + ".xlsx";
        try
         {
        File.Copy(strLocalPath + fileName, strLocalPath + "Temp\\" + filename, true);
        result = GetA31DayData(strLocalPath + "Temp\\" + filename);
         }
      catch (Exception ex)
          {
         result.Status = false;
         result.Message = "copy file to destination file exception. Msg:" + ex.Message;
         result.Anything = ex.Message;
   if (mesLog.IsErrorEnabled)
   {
 mesLog.Error(ex.StackTrace);
    }
        }
           }
     }
  else
 {
 result.Status = false;
 result.Message = "Directory not exists!";
  }
    return result;

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

长寿区| 栾城县| 洛扎县| 天柱县| 宣武区| 凤阳县| 光泽县| 孝感市| 田林县| 高州市| 康平县| 新源县| 大邑县| 怀柔区| 耒阳市| 屏南县| 嘉兴市| 夏河县| 上高县| 视频| 冕宁县| 孟州市| 黄龙县| 青州市| 乃东县| 石嘴山市| 宁河县| 麦盖提县| 清水河县| 黄平县| 淮北市| 南充市| 习水县| 定西市| 大港区| 内黄县| 红安县| 关岭| 江城| 分宜县| 苍南县|