我正在尝试读取startdate和之间的文件夹中的文件名enddate。(Datestamp在文件名上)
我正在尝试这样的事情。有没有更好或更有效的方法可以做到这一点?我在该文件夹中有成千上万个文件,但是基于开始/结束日期值,通常我之间会有一个很小的百分比文件。
startdate = "05/05/2013"
enddate = "06/06/2013"
mypath = "C:\\somepath\\"
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]
for filetoread in onlyfiles:
filesBetweenDate = [ f for f in time.strftime('%m/%d/%Y', time.gmtime(os.path.getmtime(somepath+filetoread ))) if f > startdate and f < enddate]
繁花如伊
相关分类