Skip to content

Instantly share code, notes, and snippets.

@glauesppen
Created November 24, 2017 22:52
Show Gist options
  • Save glauesppen/071c584baf17ad85e621a17a0b4562bc to your computer and use it in GitHub Desktop.
Save glauesppen/071c584baf17ad85e621a17a0b4562bc to your computer and use it in GitHub Desktop.
A path is passed and the function returns all directories and files in the tree.
import os
def list_dir(parent):
dir = os.listdir(parent)
for lists in dir:
directory = os.path.join(parent, lists)
print directory
if os.path.isdir(directory):
list_dir(directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment