Skip to content

Instantly share code, notes, and snippets.

@ergatea
Last active December 10, 2015 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ergatea/4466407 to your computer and use it in GitHub Desktop.
Save ergatea/4466407 to your computer and use it in GitHub Desktop.
迭代查找整个子目录,找出所有的子文档的路径
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