更新时间:2023-01-31 12:44:48
一点 LINQ 应该让你走上正确的道路。
这是在C#所以你需要做一点翻译,但它会给你文件按创建日期的顺序排列。您可以输入 FirstOrDefault()并获取最旧的文件
A little bit of LINQ should get you on the right path.
This is in C# so you will need to do a little translating, but it will give you the files in order of creation date. You could probably throw in a FirstOrDefault() and just get the oldest file
FileInfo[] files = info.GetFiles().OrderBy(p => p.CreationTime);