Last active
December 10, 2015 17:18
-
-
Save ergatea/4466407 to your computer and use it in GitHub Desktop.
迭代查找整个子目录,找出所有的子文档的路径
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_sub_time_paths(folder, root_vpath): | |
""" 迭代查找整个子目录,找出所有的子文档的路径 """ | |
result = [] | |
for obj in folder.values(True, False): | |
dc = obj.metadata | |
if isinstance(obj, Folder): | |
result.extend(get_sub_time_paths(obj, root_vpath)) | |
elif isinstance(obj, Page): | |
result.append(( | |
dc.get('modified', | |
dc.get('created', '')), | |
obj.vpath.replace(root_vpath + '/', ''), | |
)) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment