我有一个文件夹,其中有许多DWG文件,一些文件的例子可能是
LINCOLN 09-17 #1-29H ASBUILT 10-26-2010.dwg
LINCOLN 09-17 #1-29H FINAL 01-20-2011.dwg
CAMPBELL 07-17 #5-29H DRAFT 01-20-2011.dwg
CAMPBELL 07-17 #5-29H FINAL 01-27-2011.dwg
CAMPBELL 07-17 #5-29H FINAL 01-27-2011_1.dwg
我需要捕捉(也许在一个列表中?)只有具有FINAL的dwg文件是该文件名的最新修改的dwg文件。所以上面要捕获的文件是
^{pr2}$有什么建议吗?在
主持人,我似乎不能为下面的问题添加评论。为什么呢??在
这是我到目前为止的情况。。我在我认为需要修改的地方发表了评论
import os
rootdir='c:\Your\Path'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
# I need to check only files with the same name so I can
# get the latest of those files before checking next files
if os.path.getmtime(file):
# I believe this will get time file was modified but
# but how do I store this to compare to other files
# with this name??
你需要去寻找合适的文件,并记住每个文件中最新的 你过来看看。然后报告最新情况。在
在伪代码中。在
相关问题 更多 >
编程相关推荐