【问题标题】:how to A specific getfile These days如何获取特定的 getfile 这些天
【发布时间】:2017-09-12 17:20:08
【问题描述】:
foreach (string file in Directory.GetFiles(@"C:\tbank_file\in\ADCODE", "*.txt"))
{
    MessageBox.Show(Path.GetFileName(file));
}

code me 是在文件夹中显示消息所有文件。我想要 getfile A 特定的今天。 文件夹 me 中的文件。

【问题讨论】:

标签: c# windows-applications


【解决方案1】:

获取特定文件,例如今天创建的文件(在你的 foreach 循环中) 您可以在 GetCreationTimeGetLastWriteTime

中使用其他属性

更多信息:

https://msdn.microsoft.com/en-us/library/system.io.file(v=vs.110).aspx

  if (File.GetCreationTime(file).DayOfYear == DateTime.Now.DayOfYear)
  {
        // return your file 
  }

【讨论】:

    猜你喜欢
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-09
    • 2020-10-27
    • 2016-08-01
    • 1970-01-01
    相关资源
    最近更新 更多