show all the files under one folder

import os
def countFile(dir):
    tmp = 0
    for item in os.listdir(dir):
        if os.path.isfile(os.path.join(dir, item)):
            tmp += 1
        else:
            tmp += countFile(os.path.join(dir, item))
    return tmp

原文链接:https://blog.csdn.net/HOMEGREAT/java/article/details/82861373

posted on 2020-04-21 16:46  cdekelon  阅读(128)  评论(0编辑  收藏  举报

导航