How to get files in a directory, including all subdirectories

前端 未结 6 1467
耶瑟儿~
耶瑟儿~ 2020-12-04 12:45

I\'m trying to get a list of all log files (.log) in directory, including all subdirectories.

6条回答
  •  遥遥无期
    2020-12-04 13:28

    If You want to list in current directory, You can use something like:

    import os
    
    for e in os.walk(os.getcwd()):
        print e
    

    Just change the

    os.getcwd()
    

    to other path to get results there.

提交回复
热议问题