在Windows中查找最新的(基于时间的).txt文件 [英] To find latest(time based) .txtfile in windows

查看:212
本文介绍了在Windows中查找最新的(基于时间的).txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读取最新创建的文本文件.文件名不是常量(即小时,文件名正在更改),例如filename-1449,一些filename-1450(即14小时50分钟) .
是否可以从最近修改的时间读取.

i want to read latest text file created.the file name is not constant(i. hours, minuets is changing in file name),for example filename-1449,some filename-1450(i.e,14 hr,50 min).
is it possible to read from latest modified time.
can any one help me how is it possible.

推荐答案

您可以通过读取file属性的最后修改日期来做到这一点.假设您在一个目录下存储文件,然后逐个读取所选文件的最后修改日期,如果您对特定类型的文件感兴趣,最后还可以过滤最后修改的读取文件,也可以使用过滤器.您可以找到最新文件. :)
You can do this by reading the last modified date of the file attribute. Suppose under one directory you are storing the file then read last modified date of selected file one by one here you can also use filter if you are interested in specific type of file and at the end copmparing last modified read file. you can find out the latest file. :)


,您可以使用类CFileFind.您可以使用此类的FindNextFile()函数循环浏览文件夹中的每个文件,并可以使用GetCreationTime()GetLastWriteTime()查找文件的创建时间或修改时间.然后比较以查找最新时间
you can use the class CFileFind. you can loop through each files in the folder using the FindNextFile() function of this class and can find the creation time or modification time of the files using GetCreationTime() and GetLastWriteTime(). Then compare to find the latest time


这篇关于在Windows中查找最新的(基于时间的).txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆