Skip to content

Instantly share code, notes, and snippets.

@yeonsh
Created January 25, 2013 04:48
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 yeonsh/4631861 to your computer and use it in GitHub Desktop.
Save yeonsh/4631861 to your computer and use it in GitHub Desktop.
List directories only under given directory
import os
dir = []
def listDirectory(directory):
for f in os.listdir(directory):
path0 = os.path.join(directory, f)
if os.path.isdir(path0):
dir.append(path0)
listDirectory(path0)
listDirectory('.')
print dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment